diff options
Diffstat (limited to 'src/quick/util/qquickbehavior.cpp')
-rw-r--r-- | src/quick/util/qquickbehavior.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/quick/util/qquickbehavior.cpp b/src/quick/util/qquickbehavior.cpp index 460e2ca554..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,6 +202,14 @@ void QQuickBehavior::write(const QVariant &value) // to the item, so we need to read the value after. const QVariant ¤tValue = d->property.read(); + // 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; + } + QQuickStateOperation::ActionList actions; QQuickStateAction action; action.property = d->property; |