summaryrefslogtreecommitdiffstats
path: root/src/corelib/statemachine/qstatemachine.cpp
diff options
context:
space:
mode:
authorEskil Abrahamsen Blomfeldt <eblomfel@trolltech.com>2009-05-06 08:29:20 (GMT)
committerEskil Abrahamsen Blomfeldt <eblomfel@trolltech.com>2009-05-06 08:29:20 (GMT)
commitd2c34394b7105e26612c1fe2b2bb22be4bd8e097 (patch)
treed2a9018259510a2497d55310a6407fbd153d00eb /src/corelib/statemachine/qstatemachine.cpp
parent48ca4182e518a6439264f87b54e691deecc59e20 (diff)
downloadQt-d2c34394b7105e26612c1fe2b2bb22be4bd8e097.zip
Qt-d2c34394b7105e26612c1fe2b2bb22be4bd8e097.tar.gz
Qt-d2c34394b7105e26612c1fe2b2bb22be4bd8e097.tar.bz2
Fix bogus default start value when interrupting an animation that has an
implicit end value. We need to stop the animation prior to setting the end value to an invalid variant, otherwise the current value of the property will be updated based on the new end value and randomness will occur.
Diffstat (limited to 'src/corelib/statemachine/qstatemachine.cpp')
-rw-r--r--src/corelib/statemachine/qstatemachine.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/corelib/statemachine/qstatemachine.cpp b/src/corelib/statemachine/qstatemachine.cpp
index 6f626f5..98aa9f2 100644
--- a/src/corelib/statemachine/qstatemachine.cpp
+++ b/src/corelib/statemachine/qstatemachine.cpp
@@ -698,6 +698,13 @@ void QStateMachinePrivate::applyProperties(const QList<QAbstractTransition*> &tr
QAbstractAnimation *anim = animations.at(j);
QObject::disconnect(anim, SIGNAL(finished()), q, SLOT(_q_animationFinished()));
stateForAnimation.remove(anim);
+
+ // Stop the (top-level) animation.
+ // ### Stopping nested animation has weird behavior.
+ while (QAnimationGroup *group = anim->group())
+ anim = group;
+ anim->stop();
+
if (resetAnimationEndValues.contains(anim)) {
qobject_cast<QVariantAnimation*>(anim)->setEndValue(QVariant()); // ### generalize
resetAnimationEndValues.remove(anim);
@@ -721,11 +728,6 @@ void QStateMachinePrivate::applyProperties(const QList<QAbstractTransition*> &tr
if (!found) {
assn.object->setProperty(assn.propertyName, assn.value);
}
- // Stop the (top-level) animation.
- // ### Stopping nested animation has weird behavior.
- while (QAnimationGroup *group = anim->group())
- anim = group;
- anim->stop();
}
}