From 6c7a348cf82665f7f09bc3e0cfe03256f1462744 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Mon, 20 Oct 2014 16:25:47 +0200 Subject: Set correct transient parent in q_createNativeChildrenAndSetParent(). Fix warning: void QWindow::setTransientParent(QWindow*) ... must be a top level window. which occurred for example when parenting a QMenu onto a native child widget. Task-number: QTBUG-41898 Change-Id: Icc25fb2108bd68b2d9c0e551949b90fc7a82d358 Reviewed-by: Laszlo Agocs --- src/widgets/kernel/qwidget.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/widgets') diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp index 5529f8f72c..2d12674c29 100644 --- a/src/widgets/kernel/qwidget.cpp +++ b/src/widgets/kernel/qwidget.cpp @@ -1362,11 +1362,11 @@ void q_createNativeChildrenAndSetParent(const QWidget *parentWidget) if (!childWidget->internalWinId()) childWidget->winId(); if (childWidget->windowHandle()) { - QWindow *parentWindow = childWidget->nativeParentWidget()->windowHandle(); - if (childWidget->isWindow()) - childWidget->windowHandle()->setTransientParent(parentWindow); - else - childWidget->windowHandle()->setParent(parentWindow); + if (childWidget->isWindow()) { + childWidget->windowHandle()->setTransientParent(parentWidget->window()->windowHandle()); + } else { + childWidget->windowHandle()->setParent(childWidget->nativeParentWidget()->windowHandle()); + } } } else { q_createNativeChildrenAndSetParent(childWidget); -- cgit v1.2.3