summaryrefslogtreecommitdiffstats
path: root/src/declarative/util
diff options
context:
space:
mode:
authorMichael Brasser <michael.brasser@nokia.com>2009-07-01 02:35:25 (GMT)
committerMichael Brasser <michael.brasser@nokia.com>2009-07-01 02:35:25 (GMT)
commite44a16c440a56ccd6d9a001f01c45d7327ce8e62 (patch)
tree5a4bee95efe5a323c9f9d26e19387d370373277a /src/declarative/util
parent0200260487c888b62d7761d6f358543602b53994 (diff)
downloadQt-e44a16c440a56ccd6d9a001f01c45d7327ce8e62.zip
Qt-e44a16c440a56ccd6d9a001f01c45d7327ce8e62.tar.gz
Qt-e44a16c440a56ccd6d9a001f01c45d7327ce8e62.tar.bz2
Change reversible transition semantics.
The new semantics match those of playing a QAbstractionAnimation backward. (i.e. it is now an exact visual reverse)
Diffstat (limited to 'src/declarative/util')
-rw-r--r--src/declarative/util/qmlanimation.cpp12
-rw-r--r--src/declarative/util/qmltransition.cpp1
2 files changed, 5 insertions, 8 deletions
diff --git a/src/declarative/util/qmlanimation.cpp b/src/declarative/util/qmlanimation.cpp
index 620739f..0c8f55f 100644
--- a/src/declarative/util/qmlanimation.cpp
+++ b/src/declarative/util/qmlanimation.cpp
@@ -1347,17 +1347,9 @@ void QmlSequentialAnimation::transition(QmlStateActions &actions,
d->animations.at(i)->setTarget(d->userProperty);
}
- //XXX removing and readding isn't ideal; we do it to get around the problem mentioned below.
- for (int i = d->ag->animationCount()-1; i >= 0; --i)
- d->ag->takeAnimationAt(i);
-
for (int ii = from; ii < d->animations.count() && ii >= 0; ii += inc) {
d->animations.at(ii)->transition(actions, modified, direction);
- d->ag->addAnimation(d->animations.at(ii)->qtAnimation());
}
-
- //XXX changing direction means all the animations play in reverse, while we only want the ordering reversed.
- //d->ag->setDirection(direction == Backward ? QAbstractAnimation::Backward : QAbstractAnimation::Forward);
}
QML_DEFINE_TYPE(QmlSequentialAnimation,SequentialAnimation)
@@ -1797,8 +1789,11 @@ void QmlPropertyAnimation::transition(QmlStateActions &actions,
int interpolatorType; //for Number/ColorAnimation
int prevInterpolatorType; //for generic
QVariantAnimation::Interpolator interpolator;
+ bool reverse;
void setValue(qreal v)
{
+ if (reverse) //QVariantAnimation sends us 1->0 when reversed, but we are expecting 0->1
+ v = 1 - v;
QmlTimeLineValue::setValue(v);
for (int ii = 0; ii < actions.count(); ++ii) {
Action &action = actions[ii];
@@ -1844,6 +1839,7 @@ void QmlPropertyAnimation::transition(QmlStateActions &actions,
PropertyUpdater *data = new PropertyUpdater;
data->interpolatorType = d->interpolatorType;
data->interpolator = d->interpolator;
+ data->reverse = direction == Backward ? true : false;
QSet<QObject *> objs;
for (int ii = 0; ii < actions.count(); ++ii) {
diff --git a/src/declarative/util/qmltransition.cpp b/src/declarative/util/qmltransition.cpp
index 5931075..43a4605 100644
--- a/src/declarative/util/qmltransition.cpp
+++ b/src/declarative/util/qmltransition.cpp
@@ -176,6 +176,7 @@ void QmlTransition::prepare(QmlStateOperation::ActionList &actions,
}
d->endState = endState;
+ d->group->setDirection(d->reversed ? QAbstractAnimation::Backward : QAbstractAnimation::Forward);
d->group->start();
}