summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlberto Mardegan <alberto.mardegan@canonical.com>2014-03-31 15:25:44 +0300
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-04-01 15:54:49 +0200
commit0a86c3127241aed93be62c62c3927e9383c95fd1 (patch)
tree423cfcacec130ef089986832041be2b8196547d3
parentb4128d0f7dfe6fd5752c4ec3ecb03775ffda5949 (diff)
When looking up the window hierarchy, stop at foreign windows
If the window being activated is an embedded window, the parent window will be a foreign window (usually not even belonging to the current process); we shouldn't attempt to focus it. Task-number: QTBUG-37984 Change-Id: I2ea03a86b30bbc43cde643e18e0e1d020e5f2c84 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com> Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com>
-rw-r--r--src/widgets/kernel/qapplication_qpa.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/widgets/kernel/qapplication_qpa.cpp b/src/widgets/kernel/qapplication_qpa.cpp
index 2f6e8acd87..5a4a4591bf 100644
--- a/src/widgets/kernel/qapplication_qpa.cpp
+++ b/src/widgets/kernel/qapplication_qpa.cpp
@@ -126,8 +126,15 @@ bool QApplicationPrivate::modalState()
QWidget *qt_tlw_for_window(QWindow *wnd)
{
- while (wnd && !wnd->isTopLevel()) // QTBUG-32177, wnd might be a QQuickView embedded via window container.
- wnd = wnd->parent();
+ // QTBUG-32177, wnd might be a QQuickView embedded via window container.
+ while (wnd && !wnd->isTopLevel()) {
+ QWindow *parent = wnd->parent();
+ // Don't end up in windows not belonging to this application
+ if (parent && parent->type() != Qt::ForeignWindow)
+ wnd = wnd->parent();
+ else
+ break;
+ }
if (wnd)
foreach (QWidget *tlw, qApp->topLevelWidgets())
if (tlw->windowHandle() == wnd)