aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick
diff options
context:
space:
mode:
authorMichael Brasser <michael.brasser@jollamobile.com>2013-12-11 12:28:53 -0600
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-12-12 21:29:35 +0100
commita2dad3ddee9c4bf274a7c6469342e4104605ceeb (patch)
treeb56f831cd3fd2b9609efdd4b9656c416b4e4e9b9 /src/quick
parentf1997ba4d6e47cc13811630caeb4cc0cf7442401 (diff)
Fix SpringAnimation in Behavior when current value is set.
Fixes regression introduced by d489f2f6549a86b3949004d1c8ec68487fc2adb7. We now only avoid running the animation if the Behavior wasn't already mid-animation. This ensure correct behavior for SpringAnimation, and also correct state for 'running'. Task-number: QTBUG-21549 Change-Id: I0f97813294cca22fb7a273e222fa0549c6de9ca7 Reviewed-by: Alan Alpert (Personal) <416365416c@gmail.com>
Diffstat (limited to 'src/quick')
-rw-r--r--src/quick/util/qquickbehavior.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/quick/util/qquickbehavior.cpp b/src/quick/util/qquickbehavior.cpp
index d649f9ff97..407b80915d 100644
--- a/src/quick/util/qquickbehavior.cpp
+++ b/src/quick/util/qquickbehavior.cpp
@@ -185,7 +185,8 @@ void QQuickBehavior::write(const QVariant &value)
return;
}
- if (d->animation->isRunning() && value == d->targetValue)
+ bool behaviorActive = d->animation->isRunning();
+ if (behaviorActive && value == d->targetValue)
return;
d->targetValue = value;
@@ -201,7 +202,10 @@ void QQuickBehavior::write(const QVariant &value)
// to the item, so we need to read the value after.
const QVariant &currentValue = d->property.read();
- if (d->targetValue == currentValue) {
+ // Don't unnecessarily wake up the animation system if no real animation
+ // is needed (value has not changed). If the Behavior was already
+ // running, let it continue as normal to ensure correct behavior and state.
+ if (!behaviorActive && d->targetValue == currentValue) {
QQmlPropertyPrivate::write(d->property, value, QQmlPropertyPrivate::BypassInterceptor | QQmlPropertyPrivate::DontRemoveBinding);
return;
}