summaryrefslogtreecommitdiffstats
path: root/src/widgets/kernel/qwidget.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/widgets/kernel/qwidget.cpp')
-rw-r--r--src/widgets/kernel/qwidget.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp
index 5c42a5da23..2534a7aeba 100644
--- a/src/widgets/kernel/qwidget.cpp
+++ b/src/widgets/kernel/qwidget.cpp
@@ -8466,8 +8466,10 @@ bool QWidgetPrivate::close()
// Close native widgets via QWindow::close() in order to run QWindow
// close code. The QWidget-specific close code in handleClose() will
// in this case be called from the Close event handler in QWidgetWindow.
- if (QWindow *widgetWindow = windowHandle())
- return widgetWindow->close();
+ if (QWindow *widgetWindow = windowHandle()) {
+ if (widgetWindow->isTopLevel())
+ return widgetWindow->close();
+ }
return handleClose(QWidgetPrivate::CloseWithEvent);
}