summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorTimur Pocheptsov <timur.pocheptsov@qt.io>2018-12-18 15:13:42 +0100
committerTimur Pocheptsov <timur.pocheptsov@qt.io>2019-01-08 11:43:16 +0000
commit98552a84cec7459db1ff41d1cebadcec9ee93849 (patch)
tree95f03e2dd18801b7b092c9f52606d3f277ff6796 /src/gui
parent78b422c3415d99713cac98137a9ebad6571eb937 (diff)
Emit paletteChanged and send ApplicationPaletteChange on theme change
Fixes: QTBUG-72575 Change-Id: I407e081295a456a7bdd36de91ca5bbf74bba6078 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/kernel/qguiapplication.cpp12
-rw-r--r--src/gui/kernel/qguiapplication_p.h1
2 files changed, 13 insertions, 0 deletions
diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp
index f4e2dda05a..a63e172461 100644
--- a/src/gui/kernel/qguiapplication.cpp
+++ b/src/gui/kernel/qguiapplication.cpp
@@ -3983,6 +3983,9 @@ void QGuiApplicationPrivate::notifyThemeChanged()
!QCoreApplication::testAttribute(Qt::AA_SetPalette)) {
clearPalette();
initPalette();
+ emit qGuiApp->paletteChanged(*app_pal);
+ if (is_app_running && !is_app_closing)
+ sendApplicationPaletteChange();
}
if (!(applicationResourceFlags & ApplicationFontExplicitlySet)) {
QMutexLocker locker(&applicationFontMutex);
@@ -3991,6 +3994,15 @@ void QGuiApplicationPrivate::notifyThemeChanged()
}
}
+void QGuiApplicationPrivate::sendApplicationPaletteChange(bool toAllWidgets, const char *className)
+{
+ Q_UNUSED(toAllWidgets)
+ Q_UNUSED(className)
+
+ QEvent event(QEvent::ApplicationPaletteChange);
+ QGuiApplication::sendEvent(QGuiApplication::instance(), &event);
+}
+
#if QT_CONFIG(draganddrop)
void QGuiApplicationPrivate::notifyDragStarted(const QDrag *drag)
{
diff --git a/src/gui/kernel/qguiapplication_p.h b/src/gui/kernel/qguiapplication_p.h
index 79c1a1c820..042a36c31f 100644
--- a/src/gui/kernel/qguiapplication_p.h
+++ b/src/gui/kernel/qguiapplication_p.h
@@ -313,6 +313,7 @@ public:
protected:
virtual void notifyThemeChanged();
+ virtual void sendApplicationPaletteChange(bool toAllWidgets = false, const char *className = nullptr);
bool tryCloseRemainingWindows(QWindowList processedWindows);
#if QT_CONFIG(draganddrop)
virtual void notifyDragStarted(const QDrag *);