From db286068f352291416d1fce9fe9953f376b74798 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Tue, 24 Jan 2017 13:57:29 +0100 Subject: QQuickPopup: allow window change after component completion When visible has been set true, don't attempt to start the enter transition from componentComplete(), but wait until the popup is associated with a window. This makes it possible to share a single QQuickView instance for all data rows in tst_snippets. Task-number: QTBUG-58196 Change-Id: I9204e0d2e6468a21ee36f313daedc43d2e919ec6 Reviewed-by: Mitch Curtis --- src/quicktemplates2/qquickpopup.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/quicktemplates2/qquickpopup.cpp b/src/quicktemplates2/qquickpopup.cpp index 4852d08d..b07adeb6 100644 --- a/src/quicktemplates2/qquickpopup.cpp +++ b/src/quicktemplates2/qquickpopup.cpp @@ -431,6 +431,9 @@ void QQuickPopupPrivate::setWindow(QQuickWindow *newWindow) window = newWindow; emit q->windowChanged(newWindow); + + if (complete && visible && window) + transitionManager.transitionEnter(); } class QQuickPopupItemPrivate : public QQuickControlPrivate @@ -2215,15 +2218,17 @@ void QQuickPopup::classBegin() void QQuickPopup::componentComplete() { Q_D(QQuickPopup); - d->complete = true; if (!parentItem()) { if (QQuickItem *item = qobject_cast(parent())) setParentItem(item); else if (QQuickWindow *window = qobject_cast(parent())) setParentItem(window->contentItem()); } - if (d->visible) + + if (d->visible && d->window) d->transitionManager.transitionEnter(); + + d->complete = true; d->popupItem->componentComplete(); } -- cgit v1.2.3