diff options
authorTor Arne Vestbø <>2020-01-07 13:45:49 +0100
committerTor Arne Vestbø <>2020-01-07 15:16:13 +0100
commit5af73cd9db52da287070cede300295b90f7ced67 (patch)
parent24217594581e93b7ec3849fb56e49279c5cd3be2 (diff)
Skip WA_DontShowOnScreen widgets when checking whether application can quit
QApplication tries to close all windows on quit using closeAllWindows, but closeAllWindows skips some windows, in particular any widget with WA_DontShowOnScreen set. QApplication then tries to verify that all windows have been closed, and that logic should skip the same kind of windows as closeAllWindows does. We include WA_DontShowOnScreen so that widgets that are proxied via QGraphicProxyWidget will not prevent the application from quitting. There's still some divergence between closeAllWindows and the logic in QApplication::event's quit handling, but aligning that requires more work than this particular fix, and should probably also be based on using the return value of tryCloseAllWindows() directly. Change-Id: I2555eeee0cb04b8e736109fed57f37150efd1964 Fixes: QTBUG-81107 Reviewed-by: Friedemann Kleint <> Reviewed-by: Paul Olav Tvete <>
1 files changed, 1 insertions, 1 deletions
diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp
index bf3cf090ba..f334cc58f9 100644
--- a/src/widgets/kernel/qapplication.cpp
+++ b/src/widgets/kernel/qapplication.cpp
@@ -1868,7 +1868,7 @@ bool QApplication::event(QEvent *e)
for (auto *w : topLevelWidgets()) {
if (w->isVisible() && !(w->windowType() == Qt::Desktop) && !(w->windowType() == Qt::Popup) &&
- (!(w->windowType() == Qt::Dialog) || !w->parentWidget())) {
+ (!(w->windowType() == Qt::Dialog) || !w->parentWidget()) && !w->testAttribute(Qt::WA_DontShowOnScreen)) {
return true;