From d2c34394b7105e26612c1fe2b2bb22be4bd8e097 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Wed, 6 May 2009 10:29:20 +0200 Subject: 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. --- src/corelib/statemachine/qstatemachine.cpp | 12 +++++++----- 1 file 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 &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(anim)->setEndValue(QVariant()); // ### generalize resetAnimationEndValues.remove(anim); @@ -721,11 +728,6 @@ void QStateMachinePrivate::applyProperties(const QList &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(); } } -- cgit v0.12