From 28b14b966fe8535d7a81914b70759546b694e31b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Fri, 3 Sep 2021 15:06:59 +0200 Subject: Deduplicate maybeQuitOnLastWindowClosed handling The functionality now lives in QGuiApplication, and is triggered by QGuiApplication and QApplication after dispatching the close event to the window. The slight difference between how a Qt GUI and Qt Widget app determines if a window should contribute to the close-on-quit behavior has been abstracted into a QWindowPrivate helper. The additional checks that were in place for skipping out of the whole maybeQuitOnLastWindowClosed machinery have been kept. Task-number: QTBUG-53286 Change-Id: I81bd474755f9adb3a2b082621e5ecaa1c4726808 Reviewed-by: Qt CI Bot Reviewed-by: Volker Hilsheimer --- src/widgets/kernel/qapplication.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/widgets/kernel/qapplication.cpp') diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp index 9069b9005d..74868077b3 100644 --- a/src/widgets/kernel/qapplication.cpp +++ b/src/widgets/kernel/qapplication.cpp @@ -3342,6 +3342,10 @@ bool QApplication::notify(QObject *receiver, QEvent *e) break; } + // We don't call QGuiApplication::notify here, so we need to duplicate the logic + if (e->type() == QEvent::Close && receiver->isWindowType() && res) + d->maybeQuitOnLastWindowClosed(static_cast(receiver)); + return res; } -- cgit v1.2.3