From 68a9c5fe513e147e4cffd29b50a4714813df411e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Wed, 9 Apr 2025 10:54:49 +0200 Subject: [PATCH] Remove QWindow argument from QWindowSystemInterface::handleThemeChange The QPlatformTheme, and consumers on top such as QStyleHints, are app global, so it doesn't make sense to notify that a single window has changed its theme. None of the QPA plugins pass a QWindow to the function today, after the Windows plugin was taught a few new tricks in a preceding change. [ChangeLog][QPA] QWindowSystemInterface::handleThemeChange no longer takes an optional QWindow. Change-Id: Ia761c95559a56a00763bd3cb95332f377e8de483 Reviewed-by: Volker Hilsheimer --- src/gui/kernel/qguiapplication.cpp | 7 ++----- src/gui/kernel/qwindowsysteminterface.cpp | 4 ++-- src/gui/kernel/qwindowsysteminterface.h | 2 +- src/gui/kernel/qwindowsysteminterface_p.h | 5 ++--- 4 files changed, 7 insertions(+), 11 deletions(-) diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index c516c56bc78..3630537de26 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -2807,7 +2807,7 @@ void QGuiApplicationPrivate::processSafeAreaMarginsChangedEvent(QWindowSystemInt QGuiApplication::sendSpontaneousEvent(wse->window, &event); } -void QGuiApplicationPrivate::processThemeChanged(QWindowSystemInterfacePrivate::ThemeChangeEvent *tce) +void QGuiApplicationPrivate::processThemeChanged(QWindowSystemInterfacePrivate::ThemeChangeEvent *) { if (self) self->handleThemeChanged(); @@ -2815,10 +2815,7 @@ void QGuiApplicationPrivate::processThemeChanged(QWindowSystemInterfacePrivate:: QIconPrivate::clearIconCache(); QEvent themeChangeEvent(QEvent::ThemeChange); - if (tce->window) - QGuiApplication::sendSpontaneousEvent(tce->window, &themeChangeEvent); - else - QGuiApplication::sendSpontaneousEvent(qGuiApp, &themeChangeEvent); + QGuiApplication::sendSpontaneousEvent(qGuiApp, &themeChangeEvent); } void QGuiApplicationPrivate::handleThemeChanged() diff --git a/src/gui/kernel/qwindowsysteminterface.cpp b/src/gui/kernel/qwindowsysteminterface.cpp index 97201770d8b..fa3e2f1d04f 100644 --- a/src/gui/kernel/qwindowsysteminterface.cpp +++ b/src/gui/kernel/qwindowsysteminterface.cpp @@ -828,9 +828,9 @@ void QWindowSystemInterface::handleScreenRefreshRateChange(QScreen *screen, qrea handleWindowSystemEvent(screen, newRefreshRate); } -QT_DEFINE_QPA_EVENT_HANDLER(void, handleThemeChange, QWindow *window) +QT_DEFINE_QPA_EVENT_HANDLER(void, handleThemeChange) { - handleWindowSystemEvent(window); + handleWindowSystemEvent(); } #if QT_CONFIG(draganddrop) diff --git a/src/gui/kernel/qwindowsysteminterface.h b/src/gui/kernel/qwindowsysteminterface.h index b50afedf14c..d6783fca47f 100644 --- a/src/gui/kernel/qwindowsysteminterface.h +++ b/src/gui/kernel/qwindowsysteminterface.h @@ -199,7 +199,7 @@ public: static void handleScreenRefreshRateChange(QScreen *screen, qreal newRefreshRate); template - static void handleThemeChange(QWindow *window = nullptr); + static void handleThemeChange(); static void handleFileOpenEvent(const QString& fileName); static void handleFileOpenEvent(const QUrl &url); diff --git a/src/gui/kernel/qwindowsysteminterface_p.h b/src/gui/kernel/qwindowsysteminterface_p.h index cfc1604795e..2d2637dfa4f 100644 --- a/src/gui/kernel/qwindowsysteminterface_p.h +++ b/src/gui/kernel/qwindowsysteminterface_p.h @@ -329,9 +329,8 @@ public: class ThemeChangeEvent : public WindowSystemEvent { public: - explicit ThemeChangeEvent(QWindow * w) - : WindowSystemEvent(ThemeChange), window(w) { } - QPointer window; + explicit ThemeChangeEvent() + : WindowSystemEvent(ThemeChange) { } }; class ExposeEvent : public WindowSystemEvent {