summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel/qapplication.cpp
diff options
context:
space:
mode:
authorBradley T. Hughes <bradley.hughes@nokia.com>2010-05-20 08:52:16 (GMT)
committerBradley T. Hughes <bradley.hughes@nokia.com>2010-05-20 10:01:51 (GMT)
commit16f44ee07db46ad362a464afc2c6e6567c933870 (patch)
tree9343457968535bd69b96a9e61568b725cd9ff576 /src/gui/kernel/qapplication.cpp
parenta41534cbabd0aee90c38b9a1a133835863a7f54b (diff)
downloadQt-16f44ee07db46ad362a464afc2c6e6567c933870.zip
Qt-16f44ee07db46ad362a464afc2c6e6567c933870.tar.gz
Qt-16f44ee07db46ad362a464afc2c6e6567c933870.tar.bz2
QApplication::closeAllWindows() should ignore windows being closed
It is very common to display a dialog in response to a close event. Closing the window again will result in QWidget::close() returning true. This confuses QApplication::closeAllWindows(), since the window is still visible even though it was closed (or is closing). Solve this by ignoring windows that have the is_closing flag set in their widget data. Task-number: QTBUG-7635 Reviewed-by: Denis Dzyubenko
Diffstat (limited to 'src/gui/kernel/qapplication.cpp')
-rw-r--r--src/gui/kernel/qapplication.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/gui/kernel/qapplication.cpp b/src/gui/kernel/qapplication.cpp
index 7b62de1..b805a72 100644
--- a/src/gui/kernel/qapplication.cpp
+++ b/src/gui/kernel/qapplication.cpp
@@ -2218,15 +2218,17 @@ void QApplication::closeAllWindows()
{
bool did_close = true;
QWidget *w;
- while((w = activeModalWidget()) && did_close) {
- if(!w->isVisible())
+ while ((w = activeModalWidget()) && did_close) {
+ if (!w->isVisible() || w->data->is_closing)
break;
did_close = w->close();
}
QWidgetList list = QApplication::topLevelWidgets();
for (int i = 0; did_close && i < list.size(); ++i) {
w = list.at(i);
- if (w->isVisible() && w->windowType() != Qt::Desktop) {
+ if (w->isVisible()
+ && w->windowType() != Qt::Desktop
+ && !w->data->is_closing) {
did_close = w->close();
list = QApplication::topLevelWidgets();
i = -1;