diff options
author | Volker Hilsheimer <volker.hilsheimer@qt.io> | 2024-04-30 13:53:20 +0200 |
---|---|---|
committer | Volker Hilsheimer <volker.hilsheimer@qt.io> | 2024-05-02 19:03:42 +0200 |
commit | b5215f65c0b78bee5093525b78ab5d1f80e11396 (patch) | |
tree | d528ddb0ee7806d0d2400f37a65865c279d70961 /src/gui | |
parent | 8bc80f2e1a3b509837bef17c87d2df23b046623e (diff) |
Update QStyleHints::colorScheme before updating palettes
The code polshing palettes needs to be able to rely on an updated
value of the color scheme as reported by the QStyleHints, otherwise
styles might apply the incorrect polishing logic.
Update the style hints as part of processing theme change handling,
and do it as the first thing, before updating the palette.
Pick-to: 6.7
Task-number: QTBUG-124490
Change-Id: I393faa57ecfa6da94497ae93a4e8b5d2782ec42a
Reviewed-by: Santhosh Kumar <santhosh.kumar.selvaraj@qt.io>
Reviewed-by: Wladimir Leuschner <wladimir.leuschner@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Doris Verria <doris.verria@qt.io>
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/kernel/qguiapplication.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index 6602411798..c97374e975 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -2643,10 +2643,6 @@ void QGuiApplicationPrivate::processThemeChanged(QWindowSystemInterfacePrivate:: QIconPrivate::clearIconCache(); - const auto newColorScheme = platformTheme() ? platformTheme()->colorScheme() - : Qt::ColorScheme::Unknown; - QStyleHintsPrivate::get(QGuiApplication::styleHints())->updateColorScheme(newColorScheme); - QEvent themeChangeEvent(QEvent::ThemeChange); const QWindowList windows = tce->window ? QWindowList{tce->window} : window_list; for (auto *window : windows) @@ -2655,6 +2651,10 @@ void QGuiApplicationPrivate::processThemeChanged(QWindowSystemInterfacePrivate:: void QGuiApplicationPrivate::handleThemeChanged() { + const auto newColorScheme = platformTheme() ? platformTheme()->colorScheme() + : Qt::ColorScheme::Unknown; + QStyleHintsPrivate::get(QGuiApplication::styleHints())->updateColorScheme(newColorScheme); + updatePalette(); QIconLoader::instance()->updateSystemTheme(); |