diff options
author | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2021-10-13 15:41:28 +0200 |
---|---|---|
committer | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2021-10-20 21:17:08 +0200 |
commit | 132ed5eb51c63bd34a5d96fc29e8e3868e5ce5a5 (patch) | |
tree | 306f78bd8b9cfc4152104fe475330d384841b66e /src/widgets/kernel/qapplication.cpp | |
parent | a3c85182682c3dd2b220198f8bd8bc8c593f0f9e (diff) |
Centralize maybeLastWindowClosed checking in QWindow
Instead of plumbing QWidgetWindow close events via handleCloseEvent,
we just implement closeEvent directly. This allows QWindow do save
the state of the window/widget before the close event, so that we
know whether we should trigger lastWindowClosed handling, even if
the window was deleted as a result of the close event.
This also relieves QGuiApplication and QApplication from dealing
with the close logic in their notify functions, so that these
functions can focus on the propagation of events -- not how the
event is handled.
Change-Id: I8b586b53a53b1df1d8630c1acb635c60f191bb4b
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Diffstat (limited to 'src/widgets/kernel/qapplication.cpp')
-rw-r--r-- | src/widgets/kernel/qapplication.cpp | 5 |
1 files changed, 0 insertions, 5 deletions
diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp index 6ad6004030..fd3b5f6378 100644 --- a/src/widgets/kernel/qapplication.cpp +++ b/src/widgets/kernel/qapplication.cpp @@ -3279,11 +3279,6 @@ bool QApplication::notify(QObject *receiver, QEvent *e) res = d->notify_helper(receiver, e); break; } - } else if (receiver->isWindowType()) { - res = d->notify_helper(receiver, e); - // We don't call QGuiApplication::notify here, so we need to duplicate the logic - if (res && e->type() == QEvent::Close) - d->maybeLastWindowClosed(static_cast<QWindow *>(receiver)); } else { res = d->notify_helper(receiver, e); } |