summaryrefslogtreecommitdiffstats
path: root/src/widgets/kernel
diff options
context:
space:
mode:
authorTor Arne Vestbø <tor.arne.vestbo@qt.io>2017-01-31 13:29:14 +0100
committerTor Arne Vestbø <tor.arne.vestbo@qt.io>2017-02-09 14:10:17 +0000
commita57f2128b15d363b88c063325eac1d36c2ff1578 (patch)
tree8cfd5c6ded2a9e4adc1766905114342addb94751 /src/widgets/kernel
parentee8b61bcf56e03aae0f8e346e70330276e221843 (diff)
Add QPlatformWindow::isForeignWindow()
Simplifies code at call sites and allows for refactoring how to decide if a window is foreign or not at a later point. Change-Id: Icc51a83bac187f4975535366b53b4990832b6c82 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src/widgets/kernel')
-rw-r--r--src/widgets/kernel/qapplication.cpp9
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();