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 <volker.hilsheimer@qt.io>
This commit is contained in:
Tor Arne Vestbø 2025-04-09 10:54:49 +02:00
parent fdfed82675
commit 68a9c5fe51
4 changed files with 7 additions and 11 deletions

View File

@ -2807,7 +2807,7 @@ void QGuiApplicationPrivate::processSafeAreaMarginsChangedEvent(QWindowSystemInt
QGuiApplication::sendSpontaneousEvent(wse->window, &event); QGuiApplication::sendSpontaneousEvent(wse->window, &event);
} }
void QGuiApplicationPrivate::processThemeChanged(QWindowSystemInterfacePrivate::ThemeChangeEvent *tce) void QGuiApplicationPrivate::processThemeChanged(QWindowSystemInterfacePrivate::ThemeChangeEvent *)
{ {
if (self) if (self)
self->handleThemeChanged(); self->handleThemeChanged();
@ -2815,9 +2815,6 @@ void QGuiApplicationPrivate::processThemeChanged(QWindowSystemInterfacePrivate::
QIconPrivate::clearIconCache(); QIconPrivate::clearIconCache();
QEvent themeChangeEvent(QEvent::ThemeChange); QEvent themeChangeEvent(QEvent::ThemeChange);
if (tce->window)
QGuiApplication::sendSpontaneousEvent(tce->window, &themeChangeEvent);
else
QGuiApplication::sendSpontaneousEvent(qGuiApp, &themeChangeEvent); QGuiApplication::sendSpontaneousEvent(qGuiApp, &themeChangeEvent);
} }

View File

@ -828,9 +828,9 @@ void QWindowSystemInterface::handleScreenRefreshRateChange(QScreen *screen, qrea
handleWindowSystemEvent<QWindowSystemInterfacePrivate::ScreenRefreshRateEvent>(screen, newRefreshRate); handleWindowSystemEvent<QWindowSystemInterfacePrivate::ScreenRefreshRateEvent>(screen, newRefreshRate);
} }
QT_DEFINE_QPA_EVENT_HANDLER(void, handleThemeChange, QWindow *window) QT_DEFINE_QPA_EVENT_HANDLER(void, handleThemeChange)
{ {
handleWindowSystemEvent<QWindowSystemInterfacePrivate::ThemeChangeEvent, Delivery>(window); handleWindowSystemEvent<QWindowSystemInterfacePrivate::ThemeChangeEvent, Delivery>();
} }
#if QT_CONFIG(draganddrop) #if QT_CONFIG(draganddrop)

View File

@ -199,7 +199,7 @@ public:
static void handleScreenRefreshRateChange(QScreen *screen, qreal newRefreshRate); static void handleScreenRefreshRateChange(QScreen *screen, qreal newRefreshRate);
template<typename Delivery = QWindowSystemInterface::DefaultDelivery> template<typename Delivery = QWindowSystemInterface::DefaultDelivery>
static void handleThemeChange(QWindow *window = nullptr); static void handleThemeChange();
static void handleFileOpenEvent(const QString& fileName); static void handleFileOpenEvent(const QString& fileName);
static void handleFileOpenEvent(const QUrl &url); static void handleFileOpenEvent(const QUrl &url);

View File

@ -329,9 +329,8 @@ public:
class ThemeChangeEvent : public WindowSystemEvent { class ThemeChangeEvent : public WindowSystemEvent {
public: public:
explicit ThemeChangeEvent(QWindow * w) explicit ThemeChangeEvent()
: WindowSystemEvent(ThemeChange), window(w) { } : WindowSystemEvent(ThemeChange) { }
QPointer<QWindow> window;
}; };
class ExposeEvent : public WindowSystemEvent { class ExposeEvent : public WindowSystemEvent {