move QPalette into QtGui

also add QGuiApplication::palette() for the default
application palette.
This commit is contained in:
Lars Knoll 2011-05-06 22:08:43 +02:00
parent dcc2317f2b
commit 7ff1d396e7
10 changed files with 30 additions and 21 deletions

View File

@ -14,6 +14,7 @@ HEADERS += \
guikernel/qkeysequence_p.h \
guikernel/qkeymapper_p.h \
guikernel/qmime.h \
guikernel/qpalette.h \
guikernel/qsessionmanager.h \
guikernel/qwindowdefs.h \
@ -25,6 +26,7 @@ SOURCES += \
guikernel/qkeymapper.cpp \
guikernel/qkeymapper_qpa.cpp \
guikernel/qmime.cpp \
guikernel/qpalette.cpp \
guikernel/qguivariant.cpp \
qpa {

View File

@ -82,6 +82,8 @@ QPlatformIntegration *QGuiApplicationPrivate::platform_integration = 0;
bool QGuiApplicationPrivate::app_do_modal = false;
QPalette *QGuiApplicationPrivate::app_pal = 0; // default application palette
int qt_last_x = 0;
int qt_last_y = 0;
@ -145,6 +147,9 @@ QGuiApplication::~QGuiApplication()
delete QGuiApplicationPrivate::qt_clipboard;
QGuiApplicationPrivate::qt_clipboard = 0;
delete QGuiApplicationPrivate::app_pal;
QGuiApplicationPrivate::app_pal = 0;
#ifndef QT_NO_CURSOR
d->cursor_list.clear();
#endif
@ -610,6 +615,18 @@ QClipboard * QGuiApplication::clipboard()
}
#endif
/*!
Returns the application palette.
\sa setPalette(), QWidget::palette()
*/
QPalette QGuiApplication::palette()
{
if (!QGuiApplicationPrivate::app_pal)
QGuiApplicationPrivate::app_pal = new QPalette(Qt::black);
return *QGuiApplicationPrivate::app_pal;
}
QFont QGuiApplication::font()
{
QMutexLocker locker(applicationFontMutex());

View File

@ -56,6 +56,7 @@ QT_MODULE(Gui)
class QGuiApplicationPrivate;
class QPlatformNativeInterface;
class QPalette;
#if defined(qApp)
#undef qApp
@ -94,6 +95,8 @@ public:
static QClipboard *clipboard();
#endif
static QPalette palette();
static Qt::KeyboardModifiers keyboardModifiers();
static Qt::MouseButtons mouseButtons();

View File

@ -147,6 +147,8 @@ public:
static QClipboard *qt_clipboard;
#endif
static QPalette *app_pal;
static QWindowList window_list;
#ifndef QT_NO_CURSOR

View File

@ -40,7 +40,7 @@
****************************************************************************/
#include "qpalette.h"
#include "qapplication.h"
#include "qguiapplication.h"
#include "qdatastream.h"
#include "qvariant.h"
@ -336,7 +336,7 @@ static QColor qt_mix_colors(QColor a, QColor b)
roles are enumerated and defined in the \l ColorRole documentation.
We strongly recommend that you use the default palette of the
current style (returned by QApplication::palette()) and
current style (returned by QGuiApplication::palette()) and
modify that as necessary. This is done by Qt's widgets when they
are drawn.
@ -487,7 +487,7 @@ static QColor qt_mix_colors(QColor a, QColor b)
\sa QApplication::setPalette(), QApplication::palette()
*/
QPalette::QPalette()
: d(QApplication::palette().d),
: d(QGuiApplication::palette().d),
current_group(Active),
resolve_mask(0)
{

View File

@ -26,8 +26,7 @@ HEADERS += \
kernel/qlayoutengine_p.h \
kernel/qlayoutitem.h \
kernel/qsizepolicy.h \
kernel/qpalette.h \
kernel/qstackedlayout.h \
kernel/qstackedlayout.h \
kernel/qtooltip.h \
kernel/qwhatsthis.h \
kernel/qwidget.h \
@ -58,8 +57,7 @@ SOURCES += \
kernel/qlayout.cpp \
kernel/qlayoutengine.cpp \
kernel/qlayoutitem.cpp \
kernel/qpalette.cpp \
kernel/qstackedlayout.cpp \
kernel/qstackedlayout.cpp \
kernel/qtooltip.cpp \
kernel/qwhatsthis.cpp \
kernel/qwidget.cpp \

View File

@ -443,7 +443,6 @@ QString QApplicationPrivate::styleSheet; // default application styles
QPointer<QWidget> QApplicationPrivate::leaveAfterRelease = 0;
int QApplicationPrivate::app_cspec = QApplication::NormalColor;
QPalette *QApplicationPrivate::app_pal = 0; // default application palette
QPalette *QApplicationPrivate::sys_pal = 0; // default system palette
QPalette *QApplicationPrivate::set_pal = 0; // default palette set by programmer
@ -1678,17 +1677,6 @@ void QApplication::setGlobalStrut(const QSize& strut)
QApplicationPrivate::app_strut = strut;
}
/*!
Returns the application palette.
\sa setPalette(), QWidget::palette()
*/
QPalette QApplication::palette()
{
if (!QApplicationPrivate::app_pal)
QApplicationPrivate::app_pal = new QPalette(Qt::black);
return *QApplicationPrivate::app_pal;
}
/*!
\fn QPalette QApplication::palette(const QWidget* widget)

View File

@ -156,7 +156,7 @@ public:
// ### Qt4 compatibility, remove?
static inline void setGraphicsSystem(const QString &) {}
static QPalette palette();
using QGuiApplication::palette;
static QPalette palette(const QWidget *);
static QPalette palette(const char *className);
static void setPalette(const QPalette &, const char* className = 0);

View File

@ -402,7 +402,6 @@ public:
static QWidgetList *popupWidgets;
static QStyle *app_style;
static int app_cspec;
static QPalette *app_pal;
static QPalette *sys_pal;
static QPalette *set_pal;