diff options
author | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2020-12-10 16:06:53 +0100 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2020-12-17 22:39:43 +0000 |
commit | a0d963f43607f8719e450b572329daae8de42640 (patch) | |
tree | be7c15f7506a58500c27e4529dcc1f9154e7bc5c /src/gui | |
parent | acf00dd72d892d32bd1a7ce416a6c4556b259289 (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: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/kernel/qwindow.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/gui/kernel/qwindow.cpp b/src/gui/kernel/qwindow.cpp index 544849a197..d93f43a310 100644 --- a/src/gui/kernel/qwindow.cpp +++ b/src/gui/kernel/qwindow.cpp @@ -2776,8 +2776,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) { @@ -2789,7 +2788,8 @@ void QWindowPrivate::maybeQuitOnLastWindowClosed() } if (lastWindowClosed) { QGuiApplicationPrivate::emitLastWindowClosed(); - if (quitOnClose) { + + if (QGuiApplication::quitOnLastWindowClosed()) { QCoreApplicationPrivate *applicationPrivate = static_cast<QCoreApplicationPrivate*>(QObjectPrivate::get(QCoreApplication::instance())); applicationPrivate->maybeQuit(); } |