From 3af0f98a79f223988854e313c198f5fdf3ff5e3b Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Fri, 23 Sep 2011 09:44:09 +1000 Subject: [PATCH] Further delay animation creation in Behavior. Previously we always created the animation on the first call to write, regardless of whether the Behavior was enabled. Now we delay until the animation is needed. Change-Id: I14a319a4f045050fe6a99427b7c3804ef078d48d Reviewed-on: http://codereview.qt-project.org/5414 Reviewed-by: Qt Sanity Bot Reviewed-by: Charles Yin --- src/declarative/util/qdeclarativebehavior.cpp | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/declarative/util/qdeclarativebehavior.cpp b/src/declarative/util/qdeclarativebehavior.cpp index 84636e4..550b8a3 100644 --- a/src/declarative/util/qdeclarativebehavior.cpp +++ b/src/declarative/util/qdeclarativebehavior.cpp @@ -175,8 +175,10 @@ void QDeclarativeBehavior::setEnabled(bool enabled) void QDeclarativeBehavior::write(const QVariant &value) { Q_D(QDeclarativeBehavior); - qmlExecuteDeferred(this); - if (!d->animation || !d->enabled || !d->finalized) { + bool bypass = !d->enabled || !d->finalized; + if (!bypass) + qmlExecuteDeferred(this); + if (!d->animation || bypass) { QDeclarativePropertyPrivate::write(d->property, value, QDeclarativePropertyPrivate::BypassInterceptor | QDeclarativePropertyPrivate::DontRemoveBinding); d->targetValue = value; return; -- 1.7.2.5