diff options
author | Michael Brasser <michael.brasser@jollamobile.com> | 2013-11-26 09:18:10 -0600 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-12-04 15:26:26 +0100 |
commit | d489f2f6549a86b3949004d1c8ec68487fc2adb7 (patch) | |
tree | d3598f928bb8e1672557aba56cbedb2aea4ae23c /src/quick | |
parent | 6709e2060aff8b792fcc57004222f7de72584831 (diff) |
Behavior should not trigger when the tracked value has not changed.
Behaviors are specifically for animating changes in value. When the
value has not changed, do not trigger the animation. This ensures
the animation system is not unnecessarily woken.
[ChangeLog][QtQuick][Behavior] Do not trigger a Behavior when the
tracked value has not changed.
Task-number: QTBUG-21549
Change-Id: I5b20121ccfb75ea5ebf86705df89891c94cf6e7e
Reviewed-by: Robin Burchell <robin+qt@viroteck.net>
Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com>
Reviewed-by: Alan Alpert (Personal) <416365416c@gmail.com>
Diffstat (limited to 'src/quick')
-rw-r--r-- | src/quick/util/qquickbehavior.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/quick/util/qquickbehavior.cpp b/src/quick/util/qquickbehavior.cpp index 460e2ca554..d649f9ff97 100644 --- a/src/quick/util/qquickbehavior.cpp +++ b/src/quick/util/qquickbehavior.cpp @@ -201,6 +201,11 @@ void QQuickBehavior::write(const QVariant &value) // to the item, so we need to read the value after. const QVariant ¤tValue = d->property.read(); + if (d->targetValue == currentValue) { + QQmlPropertyPrivate::write(d->property, value, QQmlPropertyPrivate::BypassInterceptor | QQmlPropertyPrivate::DontRemoveBinding); + return; + } + QQuickStateOperation::ActionList actions; QQuickStateAction action; action.property = d->property; |