move QPalette into QtGui
also add QGuiApplication::palette() for the default application palette.
This commit is contained in:
parent
dcc2317f2b
commit
7ff1d396e7
@ -14,6 +14,7 @@ HEADERS += \
|
|||||||
guikernel/qkeysequence_p.h \
|
guikernel/qkeysequence_p.h \
|
||||||
guikernel/qkeymapper_p.h \
|
guikernel/qkeymapper_p.h \
|
||||||
guikernel/qmime.h \
|
guikernel/qmime.h \
|
||||||
|
guikernel/qpalette.h \
|
||||||
guikernel/qsessionmanager.h \
|
guikernel/qsessionmanager.h \
|
||||||
guikernel/qwindowdefs.h \
|
guikernel/qwindowdefs.h \
|
||||||
|
|
||||||
@ -25,6 +26,7 @@ SOURCES += \
|
|||||||
guikernel/qkeymapper.cpp \
|
guikernel/qkeymapper.cpp \
|
||||||
guikernel/qkeymapper_qpa.cpp \
|
guikernel/qkeymapper_qpa.cpp \
|
||||||
guikernel/qmime.cpp \
|
guikernel/qmime.cpp \
|
||||||
|
guikernel/qpalette.cpp \
|
||||||
guikernel/qguivariant.cpp \
|
guikernel/qguivariant.cpp \
|
||||||
|
|
||||||
qpa {
|
qpa {
|
||||||
|
@ -82,6 +82,8 @@ QPlatformIntegration *QGuiApplicationPrivate::platform_integration = 0;
|
|||||||
|
|
||||||
bool QGuiApplicationPrivate::app_do_modal = false;
|
bool QGuiApplicationPrivate::app_do_modal = false;
|
||||||
|
|
||||||
|
QPalette *QGuiApplicationPrivate::app_pal = 0; // default application palette
|
||||||
|
|
||||||
int qt_last_x = 0;
|
int qt_last_x = 0;
|
||||||
int qt_last_y = 0;
|
int qt_last_y = 0;
|
||||||
|
|
||||||
@ -145,6 +147,9 @@ QGuiApplication::~QGuiApplication()
|
|||||||
delete QGuiApplicationPrivate::qt_clipboard;
|
delete QGuiApplicationPrivate::qt_clipboard;
|
||||||
QGuiApplicationPrivate::qt_clipboard = 0;
|
QGuiApplicationPrivate::qt_clipboard = 0;
|
||||||
|
|
||||||
|
delete QGuiApplicationPrivate::app_pal;
|
||||||
|
QGuiApplicationPrivate::app_pal = 0;
|
||||||
|
|
||||||
#ifndef QT_NO_CURSOR
|
#ifndef QT_NO_CURSOR
|
||||||
d->cursor_list.clear();
|
d->cursor_list.clear();
|
||||||
#endif
|
#endif
|
||||||
@ -610,6 +615,18 @@ QClipboard * QGuiApplication::clipboard()
|
|||||||
}
|
}
|
||||||
#endif
|
#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()
|
QFont QGuiApplication::font()
|
||||||
{
|
{
|
||||||
QMutexLocker locker(applicationFontMutex());
|
QMutexLocker locker(applicationFontMutex());
|
||||||
|
@ -56,6 +56,7 @@ QT_MODULE(Gui)
|
|||||||
|
|
||||||
class QGuiApplicationPrivate;
|
class QGuiApplicationPrivate;
|
||||||
class QPlatformNativeInterface;
|
class QPlatformNativeInterface;
|
||||||
|
class QPalette;
|
||||||
|
|
||||||
#if defined(qApp)
|
#if defined(qApp)
|
||||||
#undef qApp
|
#undef qApp
|
||||||
@ -94,6 +95,8 @@ public:
|
|||||||
static QClipboard *clipboard();
|
static QClipboard *clipboard();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
static QPalette palette();
|
||||||
|
|
||||||
static Qt::KeyboardModifiers keyboardModifiers();
|
static Qt::KeyboardModifiers keyboardModifiers();
|
||||||
static Qt::MouseButtons mouseButtons();
|
static Qt::MouseButtons mouseButtons();
|
||||||
|
|
||||||
|
@ -147,6 +147,8 @@ public:
|
|||||||
static QClipboard *qt_clipboard;
|
static QClipboard *qt_clipboard;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
static QPalette *app_pal;
|
||||||
|
|
||||||
static QWindowList window_list;
|
static QWindowList window_list;
|
||||||
|
|
||||||
#ifndef QT_NO_CURSOR
|
#ifndef QT_NO_CURSOR
|
||||||
|
@ -40,7 +40,7 @@
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#include "qpalette.h"
|
#include "qpalette.h"
|
||||||
#include "qapplication.h"
|
#include "qguiapplication.h"
|
||||||
#include "qdatastream.h"
|
#include "qdatastream.h"
|
||||||
#include "qvariant.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.
|
roles are enumerated and defined in the \l ColorRole documentation.
|
||||||
|
|
||||||
We strongly recommend that you use the default palette of the
|
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
|
modify that as necessary. This is done by Qt's widgets when they
|
||||||
are drawn.
|
are drawn.
|
||||||
|
|
||||||
@ -487,7 +487,7 @@ static QColor qt_mix_colors(QColor a, QColor b)
|
|||||||
\sa QApplication::setPalette(), QApplication::palette()
|
\sa QApplication::setPalette(), QApplication::palette()
|
||||||
*/
|
*/
|
||||||
QPalette::QPalette()
|
QPalette::QPalette()
|
||||||
: d(QApplication::palette().d),
|
: d(QGuiApplication::palette().d),
|
||||||
current_group(Active),
|
current_group(Active),
|
||||||
resolve_mask(0)
|
resolve_mask(0)
|
||||||
{
|
{
|
@ -26,8 +26,7 @@ HEADERS += \
|
|||||||
kernel/qlayoutengine_p.h \
|
kernel/qlayoutengine_p.h \
|
||||||
kernel/qlayoutitem.h \
|
kernel/qlayoutitem.h \
|
||||||
kernel/qsizepolicy.h \
|
kernel/qsizepolicy.h \
|
||||||
kernel/qpalette.h \
|
kernel/qstackedlayout.h \
|
||||||
kernel/qstackedlayout.h \
|
|
||||||
kernel/qtooltip.h \
|
kernel/qtooltip.h \
|
||||||
kernel/qwhatsthis.h \
|
kernel/qwhatsthis.h \
|
||||||
kernel/qwidget.h \
|
kernel/qwidget.h \
|
||||||
@ -58,8 +57,7 @@ SOURCES += \
|
|||||||
kernel/qlayout.cpp \
|
kernel/qlayout.cpp \
|
||||||
kernel/qlayoutengine.cpp \
|
kernel/qlayoutengine.cpp \
|
||||||
kernel/qlayoutitem.cpp \
|
kernel/qlayoutitem.cpp \
|
||||||
kernel/qpalette.cpp \
|
kernel/qstackedlayout.cpp \
|
||||||
kernel/qstackedlayout.cpp \
|
|
||||||
kernel/qtooltip.cpp \
|
kernel/qtooltip.cpp \
|
||||||
kernel/qwhatsthis.cpp \
|
kernel/qwhatsthis.cpp \
|
||||||
kernel/qwidget.cpp \
|
kernel/qwidget.cpp \
|
||||||
|
@ -443,7 +443,6 @@ QString QApplicationPrivate::styleSheet; // default application styles
|
|||||||
QPointer<QWidget> QApplicationPrivate::leaveAfterRelease = 0;
|
QPointer<QWidget> QApplicationPrivate::leaveAfterRelease = 0;
|
||||||
|
|
||||||
int QApplicationPrivate::app_cspec = QApplication::NormalColor;
|
int QApplicationPrivate::app_cspec = QApplication::NormalColor;
|
||||||
QPalette *QApplicationPrivate::app_pal = 0; // default application palette
|
|
||||||
QPalette *QApplicationPrivate::sys_pal = 0; // default system palette
|
QPalette *QApplicationPrivate::sys_pal = 0; // default system palette
|
||||||
QPalette *QApplicationPrivate::set_pal = 0; // default palette set by programmer
|
QPalette *QApplicationPrivate::set_pal = 0; // default palette set by programmer
|
||||||
|
|
||||||
@ -1678,17 +1677,6 @@ void QApplication::setGlobalStrut(const QSize& strut)
|
|||||||
QApplicationPrivate::app_strut = 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)
|
\fn QPalette QApplication::palette(const QWidget* widget)
|
||||||
|
@ -156,7 +156,7 @@ public:
|
|||||||
// ### Qt4 compatibility, remove?
|
// ### Qt4 compatibility, remove?
|
||||||
static inline void setGraphicsSystem(const QString &) {}
|
static inline void setGraphicsSystem(const QString &) {}
|
||||||
|
|
||||||
static QPalette palette();
|
using QGuiApplication::palette;
|
||||||
static QPalette palette(const QWidget *);
|
static QPalette palette(const QWidget *);
|
||||||
static QPalette palette(const char *className);
|
static QPalette palette(const char *className);
|
||||||
static void setPalette(const QPalette &, const char* className = 0);
|
static void setPalette(const QPalette &, const char* className = 0);
|
||||||
|
@ -402,7 +402,6 @@ public:
|
|||||||
static QWidgetList *popupWidgets;
|
static QWidgetList *popupWidgets;
|
||||||
static QStyle *app_style;
|
static QStyle *app_style;
|
||||||
static int app_cspec;
|
static int app_cspec;
|
||||||
static QPalette *app_pal;
|
|
||||||
static QPalette *sys_pal;
|
static QPalette *sys_pal;
|
||||||
static QPalette *set_pal;
|
static QPalette *set_pal;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user