From 1041a95eb07e5cd25d96eec9dfc2243144638183 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Tue, 24 Jan 2017 09:53:28 +0100 Subject: QQuickPopup: allow QQuickWindow as a parent Previously it would unintuitively complain that "cannot find any window to open popup in" if a window was passed as a parent. Change-Id: I984d4c941afae12733a9c1c2f0441da867298aa1 Reviewed-by: Mitch Curtis --- src/quicktemplates2/qquickpopup.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/quicktemplates2/qquickpopup.cpp b/src/quicktemplates2/qquickpopup.cpp index 3f3caf58..4852d08d 100644 --- a/src/quicktemplates2/qquickpopup.cpp +++ b/src/quicktemplates2/qquickpopup.cpp @@ -2216,8 +2216,12 @@ void QQuickPopup::componentComplete() { Q_D(QQuickPopup); d->complete = true; - if (!parentItem()) - setParentItem(qobject_cast(parent())); + if (!parentItem()) { + if (QQuickItem *item = qobject_cast(parent())) + setParentItem(item); + else if (QQuickWindow *window = qobject_cast(parent())) + setParentItem(window->contentItem()); + } if (d->visible) d->transitionManager.transitionEnter(); d->popupItem->componentComplete(); -- cgit v1.2.3