summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTor Arne Vestbø <tor.arne.vestbo@qt.io>2020-12-10 16:06:53 +0100
committerTarja Sundqvist <tarja.sundqvist@qt.io>2021-02-10 19:33:48 +0200
commit651cfe5c44f39e66539ba3fd999671fb94b47a77 (patch)
treeae2565bcc04bf228b80c251b120569ebe7c42480
parent7e7e12be9f2e0e3b08d23dafcf8a94d73fa34caf (diff)
Clarify QWindowPrivate::maybeQuitOnLastWindowClosed
We only need to check QGuiApplication::quitOnLastWindowClosed() at the point where we've actually concluded that the last window was closed. Checking for !q->parent() was redundant, as we were already exiting early when !q->isTopLevel(). Change-Id: I934e186d707361b31d19692c04d2e17b7ba0f49e Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> (cherry picked from commit 1649137b9311a5ee3d12bc8824f5453294bd6fe9) Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
-rw-r--r--src/gui/kernel/qwindow.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/gui/kernel/qwindow.cpp b/src/gui/kernel/qwindow.cpp
index c2fc67465d..86ae522e01 100644
--- a/src/gui/kernel/qwindow.cpp
+++ b/src/gui/kernel/qwindow.cpp
@@ -2705,8 +2705,7 @@ void QWindowPrivate::maybeQuitOnLastWindowClosed()
Q_Q(QWindow);
if (!q->isTopLevel())
return;
- // Attempt to close the application only if this has WA_QuitOnClose set and a non-visible parent
- bool quitOnClose = QGuiApplication::quitOnLastWindowClosed() && !q->parent();
+
QWindowList list = QGuiApplication::topLevelWindows();
bool lastWindowClosed = true;
for (int i = 0; i < list.size(); ++i) {
@@ -2718,7 +2717,8 @@ void QWindowPrivate::maybeQuitOnLastWindowClosed()
}
if (lastWindowClosed) {
QGuiApplicationPrivate::emitLastWindowClosed();
- if (quitOnClose) {
+
+ if (QGuiApplication::quitOnLastWindowClosed()) {
QCoreApplicationPrivate *applicationPrivate = static_cast<QCoreApplicationPrivate*>(QObjectPrivate::get(QCoreApplication::instance()));
applicationPrivate->maybeQuit();
}