diff options
author | Shawn Rutledge <shawn.rutledge@digia.com> | 2014-11-07 09:32:11 +0100 |
---|---|---|
committer | Shawn Rutledge <shawn.rutledge@digia.com> | 2014-11-13 15:32:53 +0100 |
commit | ea8d4869b722f0eca2b7bbbdd77ac7e3a13ccd10 (patch) | |
tree | 58dbe8e5c84f65400831469f07af85abbda48de0 /src | |
parent | 1e0516fc69296bea7f4498127b5bd425cba15ae4 (diff) |
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 a71e285133087714034f3c84a758980c85b3801e).
Task-number: QTBUG-42464
Change-Id: I732691b0d40aba226470332426775d1bd4381009
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/widgets/kernel/qwidget.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp index 315d615d89..78eabf3c4c 100644 --- a/src/widgets/kernel/qwidget.cpp +++ b/src/widgets/kernel/qwidget.cpp @@ -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); |