diff options
author | Bradley T. Hughes <bradley.hughes@nokia.com> | 2010-05-20 08:52:16 (GMT) |
---|---|---|
committer | Bradley T. Hughes <bradley.hughes@nokia.com> | 2010-05-20 10:01:51 (GMT) |
commit | 16f44ee07db46ad362a464afc2c6e6567c933870 (patch) | |
tree | 9343457968535bd69b96a9e61568b725cd9ff576 /src/gui/kernel/qapplication.cpp | |
parent | a41534cbabd0aee90c38b9a1a133835863a7f54b (diff) | |
download | Qt-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.cpp | 8 |
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; |