From cf58057988464f68e23c4d52598fd9de791f4af7 Mon Sep 17 00:00:00 2001 From: Nikita Krupenko Date: Mon, 4 Jan 2016 20:08:27 +0200 Subject: StackView: fix stack clear on replace of the topmost item On item replace, StackView pops the topmost item (to use in transition) and call QQuickStackViewPrivate::replaceElements(), which delete items until it find the target item. When replacing the topmost item, it just clear the whole stack, as the target item not in the stack already and it procced to the bottom of the stack. This commit changes StackView to use pushElements() for replacing the topmost item, as there is nothing to replace. Task-number: QTBUG-50274 Change-Id: Iff2e1177ee2f8b2d4518b519b450ae4e89a4c963 Reviewed-by: J-P Nurmi --- src/templates/qquickstackview.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/templates') diff --git a/src/templates/qquickstackview.cpp b/src/templates/qquickstackview.cpp index 2128f3b1..e127d79f 100644 --- a/src/templates/qquickstackview.cpp +++ b/src/templates/qquickstackview.cpp @@ -636,7 +636,7 @@ void QQuickStackView::replace(QQmlV4Function *args) if (!d->elements.isEmpty()) exit = d->elements.pop(); - if (d->replaceElements(target, elements)) { + if (exit != target ? d->replaceElements(target, elements) : d->pushElements(elements)) { if (depth != d->elements.count()) emit depthChanged(); QQuickStackElement *enter = d->elements.top(); -- cgit v1.2.3