path: root/src
diff options
authorNikita Krupenko <krnekit@gmail.com>2016-01-04 20:08:27 +0200
committerNikita Krupenko <krnekit@gmail.com>2016-01-04 21:48:58 +0000
commitcf58057988464f68e23c4d52598fd9de791f4af7 (patch)
treeb76385eb9182cdbcc6ebcf42aac2b2aaad9df3de /src
parentaa7a41c5ac4b93f00f41a405da9907660fd772a6 (diff)
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 <jpnurmi@theqtcompany.com>
Diffstat (limited to 'src')
1 files changed, 1 insertions, 1 deletions
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();