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);
}
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()

View File

@ -828,9 +828,9 @@ void QWindowSystemInterface::handleScreenRefreshRateChange(QScreen *screen, qrea
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)

View File

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

View File

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