summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTor Arne Vestbø <tor.arne.vestbo@qt.io>2019-06-25 18:36:04 +0200
committerTor Arne Vestbø <tor.arne.vestbo@qt.io>2019-12-17 20:22:39 +0100
commit0a09a6341ddff4397461deb98b8d7a28ca3c9dca (patch)
treee570660852a30f7ea23d4c05f9f162fde4c07aa9 /src
parent04f5008f51dee9feec68afcee8cd8314b8e5ac62 (diff)
Sync implementation of QGuiApplication and QApplication setPalette
The two static setPalette methods in QApplication and QGuiApplication should have the same behavior in terms of what signals and events they emit. Change-Id: I54579d490e31f3783e2d4fea689ca799a070ff1d Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/gui/kernel/qguiapplication.cpp7
-rw-r--r--src/widgets/kernel/qapplication.cpp9
2 files changed, 7 insertions, 9 deletions
diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp
index bab525f809..7adba40fbd 100644
--- a/src/gui/kernel/qguiapplication.cpp
+++ b/src/gui/kernel/qguiapplication.cpp
@@ -3299,7 +3299,7 @@ void QGuiApplication::setPalette(const QPalette &pal)
QCoreApplication::setAttribute(Qt::AA_SetPalette);
if (qGuiApp)
- emit qGuiApp->paletteChanged(*QGuiApplicationPrivate::app_pal);
+ qGuiApp->d_func()->sendApplicationPaletteChange();
}
void QGuiApplicationPrivate::applyWindowGeometrySpecificationTo(QWindow *window)
@@ -4101,7 +4101,6 @@ void QGuiApplicationPrivate::notifyThemeChanged()
if (!testAttribute(Qt::AA_SetPalette)) {
clearPalette();
initPalette();
- emit qGuiApp->paletteChanged(*app_pal);
sendApplicationPaletteChange();
}
if (!(applicationResourceFlags & ApplicationFontExplicitlySet)) {
@@ -4115,7 +4114,9 @@ void QGuiApplicationPrivate::notifyThemeChanged()
void QGuiApplicationPrivate::sendApplicationPaletteChange(bool toAllWidgets, const char *className)
{
Q_UNUSED(toAllWidgets)
- Q_UNUSED(className)
+
+ if (!className)
+ emit qGuiApp->paletteChanged(*QGuiApplicationPrivate::app_pal);
if (!is_app_running || is_app_closing)
return;
diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp
index 6120e0e164..9b1202c491 100644
--- a/src/widgets/kernel/qapplication.cpp
+++ b/src/widgets/kernel/qapplication.cpp
@@ -1390,14 +1390,11 @@ void QApplicationPrivate::setPalette_helper(const QPalette &palette, const char*
hash->insert(className, pal);
}
+ if (!className && (!QApplicationPrivate::sys_pal || !palette.isCopyOf(*QApplicationPrivate::sys_pal)))
+ QCoreApplication::setAttribute(Qt::AA_SetPalette);
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);
- }
}
/*!
@@ -4433,7 +4430,7 @@ void QApplicationPrivate::sendApplicationPaletteChange(bool toAllWidgets, const
if (!is_app_running || is_app_closing)
return;
- QGuiApplicationPrivate::sendApplicationPaletteChange();
+ QGuiApplicationPrivate::sendApplicationPaletteChange(toAllWidgets, className);
QEvent event(QEvent::ApplicationPaletteChange);
const QWidgetList widgets = QApplication::allWidgets();