summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKai Uwe Broulik <kde@privat.broulik.de>2017-02-08 13:25:33 (GMT)
committerKai Uwe Broulik <kde@privat.broulik.de>2017-02-08 13:27:02 (GMT)
commitab3298b3f5f728765d5afa8830aa7793140617c8 (patch)
treed189dadfb300f63779ed54154564ee06d40ae88a
parent87b27476cc8a3865994da066ce06a3e836462719 (diff)
[KHintsSettings] Emit QGuiApplication::paletteChanged when run as QApplication
QGuiApplication::setPalette and QApplication::setPalette are two distinct static functions and when the paletteChanged signal was introduced in QGuiApplication the latter was never adjusted. SystemPalette connects to this signal to avoid installing an eventFilter on qApp for ApplicationPaletteChanged. This causes e.g. QML-based System Settings modules to not update when changing color schemes but only the widget-based application around it. CHANGELOG: QtQuick-based interfaces will now more reliably adapt to color scheme changes at runtime Differential Revision: https://phabricator.kde.org/D4492
-rw-r--r--src/platformtheme/khintssettings.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/platformtheme/khintssettings.cpp b/src/platformtheme/khintssettings.cpp
index 7768a1c..64210d4 100644
--- a/src/platformtheme/khintssettings.cpp
+++ b/src/platformtheme/khintssettings.cpp
@@ -231,7 +231,12 @@ void KHintsSettings::slotNotifyChange(int type, int arg)
//QApplication::setPalette and QGuiApplication::setPalette are different functions
//and non virtual. Call the correct one
if (qobject_cast<QApplication *>(QCoreApplication::instance())) {
- QApplication::setPalette(*m_palettes[QPlatformTheme::SystemPalette]);
+ QPalette palette = *m_palettes[QPlatformTheme::SystemPalette];
+ QApplication::setPalette(palette);
+ // QTBUG QGuiApplication::paletteChanged() signal is only emitted by QGuiApplication
+ // so things like SystemPalette QtQuick item that use it won't notice a palette
+ // change when a QApplication which causes e.g. QML System Settings modules to not update
+ emit qApp->paletteChanged(palette);
} else if (qobject_cast<QGuiApplication *>(QCoreApplication::instance())) {
QGuiApplication::setPalette(*m_palettes[QPlatformTheme::SystemPalette]);
}