Make closeAllWindows() close real windows only.

QApplication::closeAllWindows() is documented to close
all top-level windows. If the widget has WA_DontShowOnScreen
set then that is a strong indication that this widget
is, in fact, not a top-level window.

[ChangeLog][QtWidgets][Mac] QWidgets embedded in
QGraphicsProxyWidget are no longer sent close events
when the app is closed.

Task-number: QTBUG-33716
Change-Id: I0925ed67a2d2088ca9f950a4a43bc2729b88a86c
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
This commit is contained in:
Morten Johan Sørvig 2014-01-28 14:53:49 +01:00 committed by The Qt Project
parent ee55244df4
commit bb7bf6ca17

View File

@ -1749,7 +1749,8 @@ bool QApplicationPrivate::tryCloseAllWidgetWindows(QWindowList *processedWindows
QWidgetList list = QApplication::topLevelWidgets();
for (int i = 0; i < list.size(); ++i) {
QWidget *w = list.at(i);
if (w->isVisible() && w->windowType() != Qt::Desktop && !w->data->is_closing) {
if (w->isVisible() && w->windowType() != Qt::Desktop &&
!w->testAttribute(Qt::WA_DontShowOnScreen) && !w->data->is_closing) {
QWindow *window = w->windowHandle();
if (!w->close()) // Qt::WA_DeleteOnClose may cause deletion.
return false;