summaryrefslogtreecommitdiffstats
path: root/src/widgets/kernel
diff options
context:
space:
mode:
authorQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2019-12-27 01:00:05 +0100
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2019-12-27 09:29:30 +0100
commit4054c0d6ed8bafe7ca68d981daf1be51a55fe6f1 (patch)
treeb4e000e7db3ef633983fab4dc1957721fd904657 /src/widgets/kernel
parent3ea7caed6f949953706aaa6ce00d79aa8ca15a60 (diff)
parent25101f0984e86aa30f34773eb5b2025f58086b71 (diff)
Merge remote-tracking branch 'origin/5.14' into 5.15
Conflicts: .qmake.conf src/plugins/platforms/xcb/qxcbscreen.cpp src/widgets/accessible/qaccessiblewidget.cpp Change-Id: Ib3138e61ba7981610940509a7ff02ba2dd281bf0
Diffstat (limited to 'src/widgets/kernel')
-rw-r--r--src/widgets/kernel/qapplication.cpp23
1 files changed, 11 insertions, 12 deletions
diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp
index 3577414713..85542a75f8 100644
--- a/src/widgets/kernel/qapplication.cpp
+++ b/src/widgets/kernel/qapplication.cpp
@@ -1354,15 +1354,14 @@ QPalette QApplication::palette(const QWidget* w)
*/
QPalette QApplication::palette(const char *className)
{
- if (!QApplicationPrivate::app_pal)
- palette();
PaletteHash *hash = app_palettes();
if (className && hash && hash->size()) {
QHash<QByteArray, QPalette>::ConstIterator it = hash->constFind(className);
if (it != hash->constEnd())
return *it;
}
- return *QApplicationPrivate::app_pal;
+
+ return QGuiApplication::palette();
}
void QApplicationPrivate::setPalette_helper(const QPalette &palette, const char* className, bool clearWidgetPaletteHash)
@@ -1381,6 +1380,10 @@ void QApplicationPrivate::setPalette_helper(const QPalette &palette, const char*
QApplicationPrivate::app_pal = new QPalette(pal);
else
*QApplicationPrivate::app_pal = pal;
+
+ if (!QApplicationPrivate::sys_pal || !palette.isCopyOf(*QApplicationPrivate::sys_pal))
+ QCoreApplication::setAttribute(Qt::AA_SetPalette);
+
if (hash && hash->size()) {
all = true;
if (clearWidgetPaletteHash)
@@ -1390,15 +1393,8 @@ void QApplicationPrivate::setPalette_helper(const QPalette &palette, const char*
hash->insert(className, pal);
}
- if (QApplicationPrivate::is_app_running && !QApplicationPrivate::is_app_closing) {
- // Send ApplicationPaletteChange to qApp itself, and to the widgets.
+ if (qApp)
qApp->d_func()->sendApplicationPaletteChange(all, className);
- }
-
- if (!className && (!QApplicationPrivate::sys_pal || !palette.isCopyOf(*QApplicationPrivate::sys_pal))) {
- QCoreApplication::setAttribute(Qt::AA_SetPalette);
- emit qGuiApp->paletteChanged(*QGuiApplicationPrivate::app_pal);
- }
}
/*!
@@ -4431,7 +4427,10 @@ void QApplicationPrivate::notifyThemeChanged()
void QApplicationPrivate::sendApplicationPaletteChange(bool toAllWidgets, const char *className)
{
- QGuiApplicationPrivate::sendApplicationPaletteChange();
+ if (!is_app_running || is_app_closing)
+ return;
+
+ QGuiApplicationPrivate::sendApplicationPaletteChange(toAllWidgets, className);
QEvent event(QEvent::ApplicationPaletteChange);
const QWidgetList widgets = QApplication::allWidgets();