summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@qt.io>2017-01-24 13:57:29 +0100
committerJ-P Nurmi <jpnurmi@qt.io>2017-01-25 12:08:56 +0000
commitdb286068f352291416d1fce9fe9953f376b74798 (patch)
treeac89e8da1ea20a8d17543ac403f404a31c54cb1d
parent1041a95eb07e5cd25d96eec9dfc2243144638183 (diff)
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 <mitch.curtis@qt.io>
-rw-r--r--src/quicktemplates2/qquickpopup.cpp9
1 files changed, 7 insertions, 2 deletions
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<QQuickItem *>(parent()))
setParentItem(item);
else if (QQuickWindow *window = qobject_cast<QQuickWindow *>(parent()))
setParentItem(window->contentItem());
}
- if (d->visible)
+
+ if (d->visible && d->window)
d->transitionManager.transitionEnter();
+
+ d->complete = true;
d->popupItem->componentComplete();
}