diff options
Diffstat (limited to 'src/widgets/kernel/qapplication.cpp')
-rw-r--r-- | src/widgets/kernel/qapplication.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp index 008b2a0d77..2c85ed3c0b 100644 --- a/src/widgets/kernel/qapplication.cpp +++ b/src/widgets/kernel/qapplication.cpp @@ -2161,11 +2161,14 @@ QWidget *qt_tlw_for_window(QWindow *wnd) // QTBUG-32177, wnd might be a QQuickView embedded via window container. while (wnd && !wnd->isTopLevel()) { QWindow *parent = wnd->parent(); + if (!parent) + break; + // Don't end up in windows not belonging to this application - if (parent && parent->type() != Qt::ForeignWindow) - wnd = wnd->parent(); - else + if (parent->handle() && parent->handle()->isForeignWindow()) break; + + wnd = wnd->parent(); } if (wnd) { const auto tlws = qApp->topLevelWidgets(); |