From b1df84b9d8758c7a59e722a5deb952cfa99a6dcb Mon Sep 17 00:00:00 2001 From: Axel Spoerl Date: Fri, 28 Oct 2022 15:13:11 +0200 Subject: Emit windowStateChanged in QGuiApplicationPrivate instead of QWindow MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When the visual state of a QWindow changed, QGuiApplicationPrivate sent an event to QWindow, where the visibility was updated and the signal was emitted. Following the pricinple of other visual updates, these actions have been moved to QGuiApplicationPrivate. Task-number: QTBUG-102478 Change-Id: I94f2f5b7570580ce422ca9dc03013742f6a9baba Reviewed-by: Tor Arne Vestbø --- src/gui/kernel/qguiapplication.cpp | 8 ++++++-- src/gui/kernel/qwindow.cpp | 7 ------- 2 files changed, 6 insertions(+), 9 deletions(-) (limited to 'src/gui/kernel') diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index 960bc81a57..646c705148 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -2507,9 +2507,13 @@ void QGuiApplicationPrivate::processActivatedEvent(QWindowSystemInterfacePrivate void QGuiApplicationPrivate::processWindowStateChangedEvent(QWindowSystemInterfacePrivate::WindowStateChangedEvent *wse) { - if (QWindow *window = wse->window.data()) { + if (QWindow *window = wse->window.data()) { + QWindowPrivate *windowPrivate = qt_window_private(window); + const auto newEffectiveState = QWindowPrivate::effectiveState(windowPrivate->windowState); QWindowStateChangeEvent e(wse->oldState); - window->d_func()->windowState = wse->newState; + windowPrivate->windowState = wse->newState; + emit window->windowStateChanged(newEffectiveState); + windowPrivate->updateVisibility(); QGuiApplication::sendSpontaneousEvent(window, &e); } } diff --git a/src/gui/kernel/qwindow.cpp b/src/gui/kernel/qwindow.cpp index 2d664f1117..d01ff11aa7 100644 --- a/src/gui/kernel/qwindow.cpp +++ b/src/gui/kernel/qwindow.cpp @@ -2501,13 +2501,6 @@ bool QWindow::event(QEvent *ev) setIcon(icon()); break; - case QEvent::WindowStateChange: { - Q_D(QWindow); - emit windowStateChanged(QWindowPrivate::effectiveState(d->windowState)); - d->updateVisibility(); - break; - } - #if QT_CONFIG(tabletevent) case QEvent::TabletPress: case QEvent::TabletMove: -- cgit v1.2.3