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 f686341f6e..9f4098a88a 100644
--- a/src/widgets/kernel/qwidget.cpp
+++ b/src/widgets/kernel/qwidget.cpp
@@ -1255,8 +1255,10 @@ void QWidgetPrivate::createRecursively()
QWindow *QWidgetPrivate::windowHandle(WindowHandleMode mode) const
{
if (mode == WindowHandleMode::Direct || mode == WindowHandleMode::Closest) {
- if (QTLWExtra *x = maybeTopData())
- return x->window;
+ if (QTLWExtra *x = maybeTopData()) {
+ if (x->window != nullptr || mode == WindowHandleMode::Direct)
+ return x->window;
+ }
}
if (mode == WindowHandleMode::Closest) {
if (auto nativeParent = q_func()->nativeParentWidget()) {