a widget's window is transient for its parent's top-level window

When a widget's parent's window is not a top-level window, it should
find the top-level window before calling setTransientParent,
to avoid a warning (since a71e285133).

Task-number: QTBUG-42464
Change-Id: I732691b0d40aba226470332426775d1bd4381009
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
This commit is contained in:
Shawn Rutledge 2014-11-07 09:32:11 +01:00
parent 1e0516fc69
commit ea8d4869b7

View File

@ -10511,8 +10511,9 @@ void QWidgetPrivate::setParent_sys(QWidget *newparent, Qt::WindowFlags f)
QWidget *parentWithWindow =
newparent ? (newparent->windowHandle() ? newparent : newparent->nativeParentWidget()) : 0;
if (parentWithWindow) {
if (f & Qt::Window) {
q->windowHandle()->setTransientParent(parentWithWindow->windowHandle());
QWidget *topLevel = parentWithWindow->window();
if ((f & Qt::Window) && topLevel && topLevel->windowHandle()) {
q->windowHandle()->setTransientParent(topLevel->windowHandle());
q->windowHandle()->setParent(0);
} else {
q->windowHandle()->setTransientParent(0);