diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index c605b5ad6a..370e7654ce 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -2623,12 +2623,13 @@ void QGuiApplicationPrivate::processSafeAreaMarginsChangedEvent(QWindowSystemInt void QGuiApplicationPrivate::processThemeChanged(QWindowSystemInterfacePrivate::ThemeChangeEvent *tce) { - QStyleHintsPrivate::get(QGuiApplication::styleHints())->setColorScheme(colorScheme()); if (self) self->handleThemeChanged(); QIconPrivate::clearIconCache(); + QStyleHintsPrivate::get(QGuiApplication::styleHints())->setColorScheme(colorScheme()); + QEvent themeChangeEvent(QEvent::ThemeChange); const QWindowList windows = tce->window ? QWindowList{tce->window} : window_list; for (auto *window : windows) diff --git a/src/gui/kernel/qguiapplication_p.h b/src/gui/kernel/qguiapplication_p.h index ec63876058..272ca3f8e2 100644 --- a/src/gui/kernel/qguiapplication_p.h +++ b/src/gui/kernel/qguiapplication_p.h @@ -320,6 +320,8 @@ public: static void updatePalette(); + static Qt::ColorScheme colorScheme(); + protected: virtual void handleThemeChanged(); @@ -336,8 +338,6 @@ private: friend class QDragManager; - static Qt::ColorScheme colorScheme(); - static QGuiApplicationPrivate *self; static int m_fakeMouseSourcePointId; #ifdef Q_OS_WIN diff --git a/src/plugins/styles/windowsvista/qwindowsvistastyle.cpp b/src/plugins/styles/windowsvista/qwindowsvistastyle.cpp index 14ef72ad56..ab6f34418c 100644 --- a/src/plugins/styles/windowsvista/qwindowsvistastyle.cpp +++ b/src/plugins/styles/windowsvista/qwindowsvistastyle.cpp @@ -4810,7 +4810,7 @@ void QWindowsVistaStyle::polish(QPalette &pal) { Q_D(QWindowsVistaStyle); - if (qApp->styleHints()->colorScheme() == Qt::ColorScheme::Dark) { + if (QGuiApplicationPrivate::colorScheme() == Qt::ColorScheme::Dark) { // System runs in dark mode, but the Vista style cannot use a dark palette. // Overwrite with the light system palette. using QWindowsApplication = QNativeInterface::Private::QWindowsApplication;