aboutsummaryrefslogtreecommitdiffstats
path: root/src/quicktemplates2/qquickstackview.cpp
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@qt.io>2016-07-14 10:09:41 +0200
committerJ-P Nurmi <jpnurmi@qt.io>2016-07-14 13:16:21 +0000
commitacecb06f1890feab9fee20345cd768ae61a8ae35 (patch)
tree6276f226eba82d168af04150f297a012c2a55dd4 /src/quicktemplates2/qquickstackview.cpp
parent16a142977dd328689f2de4eb35c52340aceea204 (diff)
Refactor QQuickStackView transition startup
Merge the separate but very similar looking popTransition(), pushTransition(), and replaceTransition() methods to a single startTransition() method, and pass the necessary arguments in a QQuickStackTransition structure. This is an enabler step for being able to specify the desired transition type for replace (and push & pop, for that matter) operations. Change-Id: Ia68bb94dc9280aace8718f4df0e798a7f1469e78 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'src/quicktemplates2/qquickstackview.cpp')
-rw-r--r--src/quicktemplates2/qquickstackview.cpp18
1 files changed, 14 insertions, 4 deletions
diff --git a/src/quicktemplates2/qquickstackview.cpp b/src/quicktemplates2/qquickstackview.cpp
index 597cc358..46c1d96e 100644
--- a/src/quicktemplates2/qquickstackview.cpp
+++ b/src/quicktemplates2/qquickstackview.cpp
@@ -466,7 +466,9 @@ void QQuickStackView::push(QQmlV4Function *args)
if (d->pushElements(elements)) {
emit depthChanged();
QQuickStackElement *enter = d->elements.top();
- d->pushTransition(enter, exit, boundingRect(), operation == Immediate);
+ d->startTransition(QQuickStackTransition::enter(QQuickStackTransition::Push, enter, this),
+ QQuickStackTransition::exit(QQuickStackTransition::Push, exit, this),
+ operation == Immediate);
d->setCurrentItem(enter->item);
}
@@ -548,10 +550,14 @@ void QQuickStackView::pop(QQmlV4Function *args)
QQuickItem *previousItem = nullptr;
if (d->popElements(enter)) {
- if (exit)
+ if (exit) {
+ exit->removal = true;
previousItem = exit->item;
+ }
emit depthChanged();
- d->popTransition(enter, exit, boundingRect(), operation == Immediate);
+ d->startTransition(QQuickStackTransition::exit(QQuickStackTransition::Pop, exit, this),
+ QQuickStackTransition::enter(QQuickStackTransition::Pop, enter, this),
+ operation == Immediate);
d->setCurrentItem(enter->item);
}
@@ -650,8 +656,12 @@ void QQuickStackView::replace(QQmlV4Function *args)
if (exit != target ? d->replaceElements(target, elements) : d->pushElements(elements)) {
if (depth != d->elements.count())
emit depthChanged();
+ if (exit)
+ exit->removal = true;
QQuickStackElement *enter = d->elements.top();
- d->replaceTransition(enter, exit, boundingRect(), operation == Immediate);
+ d->startTransition(QQuickStackTransition::exit(QQuickStackTransition::Replace, exit, this),
+ QQuickStackTransition::enter(QQuickStackTransition::Replace, enter, this),
+ operation == Immediate);
d->setCurrentItem(enter->item);
}