summaryrefslogtreecommitdiffstats
path: root/src/widgets/kernel/qwidget_qpa.cpp
diff options
context:
space:
mode:
authorDebao Zhang <dbzhang800@gmail.com>2012-06-01 04:10:16 -0700
committerQt by Nokia <qt-info@nokia.com>2012-06-04 22:28:48 +0200
commit13714cdd64d96b0c37c8120143c03436900c256d (patch)
treedbbb75a5423ca9a75fdc1c645750a88b1758bd54 /src/widgets/kernel/qwidget_qpa.cpp
parentf7c2ba9bbe764a3f21da3fdc6a1e1c6c6da85a8f (diff)
Fix parent-children relationship of QWidgetWindows
For a native child widget, widget->nativeParentWidget()->windowHandle() should always equal to widget->windowHandle()->parent() Change-Id: I2560689d32b0cb2834ed33f96c1c70ef3c14342d Reviewed-by: Miikka Heikkinen <miikka.heikkinen@digia.com> Reviewed-by: Laszlo Agocs <laszlo.p.agocs@nokia.com> Reviewed-by: Girish Ramakrishnan <girish.1.ramakrishnan@nokia.com>
Diffstat (limited to 'src/widgets/kernel/qwidget_qpa.cpp')
-rw-r--r--src/widgets/kernel/qwidget_qpa.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/widgets/kernel/qwidget_qpa.cpp b/src/widgets/kernel/qwidget_qpa.cpp
index bf5a8df7c0..355af1740e 100644
--- a/src/widgets/kernel/qwidget_qpa.cpp
+++ b/src/widgets/kernel/qwidget_qpa.cpp
@@ -59,7 +59,7 @@
QT_BEGIN_NAMESPACE
-void q_createNativeChildrenAndSetParent(QWindow *parentWindow, const QWidget *parentWidget)
+void q_createNativeChildrenAndSetParent(const QWidget *parentWidget)
{
QObjectList children = parentWidget->children();
for (int i = 0; i < children.size(); i++) {
@@ -70,13 +70,14 @@ void q_createNativeChildrenAndSetParent(QWindow *parentWindow, const QWidget *pa
if (!childWidget->windowHandle())
childWidget->winId();
if (childWidget->windowHandle()) {
- if (childWidget->isTopLevel())
+ QWindow *parentWindow = childWidget->nativeParentWidget()->windowHandle();
+ if (childWidget->isWindow())
childWidget->windowHandle()->setTransientParent(parentWindow);
else
childWidget->windowHandle()->setParent(parentWindow);
}
} else {
- q_createNativeChildrenAndSetParent(parentWindow,childWidget);
+ q_createNativeChildrenAndSetParent(childWidget);
}
}
}
@@ -147,7 +148,7 @@ void QWidgetPrivate::create_sys(WId window, bool initializeWindow, bool destroyO
setWinId(win->winId());
// Check children and create windows for them if necessary
- q_createNativeChildrenAndSetParent(q->windowHandle(), q);
+ q_createNativeChildrenAndSetParent(q);
// If widget is already shown, set window visible, too
if (q->isVisible())