summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorStephen Kelly <stephen.kelly@kdab.com>2012-05-14 16:58:26 +0200
committerQt by Nokia <qt-info@nokia.com>2012-06-12 04:30:18 +0200
commitc5665a182db5002afe6dc7c69f343e89de5fca31 (patch)
treeaf488d02a88f3de714629303029c77240d697574 /src/gui
parentc66dc44968f4ae51e01cee7c7605991177d5e081 (diff)
Only quit if there are no visible widgets or windows.
We need to let the QGuiApplication determine whether quitting is appropriate based on whether there are visible top level QWindows after the last top-level QWidget was closed. This solves the issue raised here: http://thread.gmane.org/gmane.comp.lib.qt.user/1880 The transientParent is the QWindow equivalent of parentWidget on QWidget, so the test in QGuiApplication::shouldQuit is similar to the one in QApplication::shouldQuit. Change-Id: I500eff8d5887f24415180134b3a4be3c630a896f Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com>
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/kernel/qguiapplication.cpp2
-rw-r--r--src/gui/kernel/qwindow.cpp2
2 files changed, 2 insertions, 2 deletions
diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp
index 3e999bee8d..846b7d01bf 100644
--- a/src/gui/kernel/qguiapplication.cpp
+++ b/src/gui/kernel/qguiapplication.cpp
@@ -2129,7 +2129,7 @@ bool QGuiApplicationPrivate::shouldQuit()
QWindowList list = QGuiApplication::topLevelWindows();
for (int i = 0; i < list.size(); ++i) {
QWindow *w = list.at(i);
- if (w->isVisible())
+ if (w->isVisible() && !w->transientParent())
return false;
}
return true;
diff --git a/src/gui/kernel/qwindow.cpp b/src/gui/kernel/qwindow.cpp
index 8fe62bb7fd..f30a794b55 100644
--- a/src/gui/kernel/qwindow.cpp
+++ b/src/gui/kernel/qwindow.cpp
@@ -1708,7 +1708,7 @@ void QWindowPrivate::maybeQuitOnLastWindowClosed()
bool lastWindowClosed = true;
for (int i = 0; i < list.size(); ++i) {
QWindow *w = list.at(i);
- if (!w->isVisible())
+ if (!w->isVisible() || w->transientParent())
continue;
lastWindowClosed = false;
break;