diff options
author | J-P Nurmi <jpnurmi@theqtcompany.com> | 2015-09-25 21:30:59 +0200 |
---|---|---|
committer | J-P Nurmi <jpnurmi@theqtcompany.com> | 2015-10-23 15:34:00 +0000 |
commit | e1bf1e9a03066a9029132e476794d3f16abcd6ff (patch) | |
tree | e2714d3b5267014500dfe293a0616c22e803476b /src/templates/qquickstackview.cpp | |
parent | 2bbe54908b7ccfef8448b2db586be2c3a25bbcb6 (diff) |
StackView: add dedicated replace transitions
Change-Id: I614d11bb566c96166ebf8bc0d2f5d4286d823a5f
Reviewed-by: Kai Uwe Broulik <kde@privat.broulik.de>
Reviewed-by: Mitch Curtis <mitch.curtis@theqtcompany.com>
Diffstat (limited to 'src/templates/qquickstackview.cpp')
-rw-r--r-- | src/templates/qquickstackview.cpp | 62 |
1 files changed, 57 insertions, 5 deletions
diff --git a/src/templates/qquickstackview.cpp b/src/templates/qquickstackview.cpp index 33f21c95..075830a4 100644 --- a/src/templates/qquickstackview.cpp +++ b/src/templates/qquickstackview.cpp @@ -207,12 +207,12 @@ QT_BEGIN_NAMESPACE to entering and exiting items. These animations define how the entering item should animate in, and the exiting item should animate out. The animations can be customized by assigning different \l{Transition}s for the - \l pushEnter, \l pushExit, \l popEnter, and \l popExit properties of - StackView. + \l pushEnter, \l pushExit, \l popEnter, \l popExit, \l replaceEnter, and + \l replaceExit properties of StackView. - \note The pop and push transition animations affect each others' - transitional behavior. So customizing the animation for one and leaving - the other may give unexpected results. + \note The transition animations affect each others' transitional behavior. + Customizing the animation for one and leaving the other may give unexpected + results. The following snippet defines a simple fade transition for push and pop operations: @@ -794,6 +794,58 @@ void QQuickStackView::setPushExit(QQuickTransition *exit) } } +/*! + \qmlproperty Transition Qt.labs.controls::StackView::replaceEnter + + This property holds the transition that is applied to the item that + enters the stack when another item is replaced by it. + + \sa {Customizing StackView} +*/ +QQuickTransition *QQuickStackView::replaceEnter() const +{ + Q_D(const QQuickStackView); + if (d->transitioner) + return d->transitioner->moveTransition; + return Q_NULLPTR; +} + +void QQuickStackView::setReplaceEnter(QQuickTransition *enter) +{ + Q_D(QQuickStackView); + d->ensureTransitioner(); + if (d->transitioner->moveTransition != enter) { + d->transitioner->moveTransition = enter; + emit replaceEnterChanged(); + } +} + +/*! + \qmlproperty Transition Qt.labs.controls::StackView::replaceExit + + This property holds the transition that is applied to the item that + exits the stack when it is replaced by another item. + + \sa {Customizing StackView} +*/ +QQuickTransition *QQuickStackView::replaceExit() const +{ + Q_D(const QQuickStackView); + if (d->transitioner) + return d->transitioner->moveDisplacedTransition; + return Q_NULLPTR; +} + +void QQuickStackView::setReplaceExit(QQuickTransition *exit) +{ + Q_D(QQuickStackView); + d->ensureTransitioner(); + if (d->transitioner->moveDisplacedTransition != exit) { + d->transitioner->moveDisplacedTransition = exit; + emit replaceExitChanged(); + } +} + void QQuickStackView::componentComplete() { QQuickControl::componentComplete(); |