diff options
author | Michael Brasser <michael.brasser@nokia.com> | 2009-09-28 00:38:30 (GMT) |
---|---|---|
committer | Michael Brasser <michael.brasser@nokia.com> | 2009-10-11 22:47:47 (GMT) |
commit | ac507b4752dcd065038130d224910a6dc64f8f37 (patch) | |
tree | 629acc0c7b4afd4b474d66b27bf8b6ca161c85c0 /src/declarative/util | |
parent | 9b7d77460c38ec93d98fa4779826b32bea2eaaff (diff) | |
download | Qt-ac507b4752dcd065038130d224910a6dc64f8f37.zip Qt-ac507b4752dcd065038130d224910a6dc64f8f37.tar.gz Qt-ac507b4752dcd065038130d224910a6dc64f8f37.tar.bz2 |
Improve Behavior reliability.
Diffstat (limited to 'src/declarative/util')
-rw-r--r-- | src/declarative/util/qmlanimation.cpp | 24 | ||||
-rw-r--r-- | src/declarative/util/qmltransitionmanager.cpp | 11 |
2 files changed, 19 insertions, 16 deletions
diff --git a/src/declarative/util/qmlanimation.cpp b/src/declarative/util/qmlanimation.cpp index 3edbc5f..247e64c 100644 --- a/src/declarative/util/qmlanimation.cpp +++ b/src/declarative/util/qmlanimation.cpp @@ -972,7 +972,7 @@ void QmlPropertyAction::setValue(const QVariant &v) void QmlPropertyActionPrivate::doAction() { - property.write(value); + property.write(value, QmlMetaProperty::BypassInterceptor | QmlMetaProperty::DontRemoveBinding); } QAbstractAnimation *QmlPropertyAction::qtAnimation() @@ -1007,9 +1007,7 @@ void QmlPropertyAction::transition(QmlStateActions &actions, { for (int ii = 0; ii < actions.count(); ++ii) { const Action &action = actions.at(ii); - QmlBehavior::_ignore = true; - action.property.write(action.toValue); - QmlBehavior::_ignore = false; + action.property.write(action.toValue, QmlMetaProperty::BypassInterceptor | QmlMetaProperty::DontRemoveBinding); } } }; @@ -1020,9 +1018,11 @@ void QmlPropertyAction::transition(QmlStateActions &actions, if (!d->propertyName.isEmpty() && !props.contains(d->propertyName)) props.append(d->propertyName); + bool targetNeedsReset = false; if (d->userProperty.isValid() && props.isEmpty() && !target()) { props.append(d->userProperty.value.name()); d->target = d->userProperty.value.object(); + targetNeedsReset = true; } QmlSetPropertyAnimationAction *data = new QmlSetPropertyAnimationAction; @@ -1070,6 +1070,8 @@ void QmlPropertyAction::transition(QmlStateActions &actions, } else { delete data; } + if (targetNeedsReset) + d->target = 0; } QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,PropertyAction,QmlPropertyAction) @@ -1714,10 +1716,10 @@ void QmlPropertyAnimationPrivate::valueChanged(qreal r) } if (r == 1.) { - property.write(to); + property.write(to, QmlMetaProperty::BypassInterceptor | QmlMetaProperty::DontRemoveBinding); } else { if (interpolator) - property.write(interpolator(from.constData(), to.constData(), r)); + property.write(interpolator(from.constData(), to.constData(), r), QmlMetaProperty::BypassInterceptor | QmlMetaProperty::DontRemoveBinding); } } @@ -1773,9 +1775,8 @@ void QmlPropertyAnimation::transition(QmlStateActions &actions, for (int ii = 0; ii < actions.count(); ++ii) { Action &action = actions[ii]; - QmlBehavior::_ignore = true; if (v == 1.) - action.property.write(action.toValue); + action.property.write(action.toValue, QmlMetaProperty::BypassInterceptor | QmlMetaProperty::DontRemoveBinding); else { if (action.fromValue.isNull()) { action.fromValue = action.property.read(); @@ -1790,9 +1791,8 @@ void QmlPropertyAnimation::transition(QmlStateActions &actions, } } if (interpolator) - action.property.write(interpolator(action.fromValue.constData(), action.toValue.constData(), v)); + action.property.write(interpolator(action.fromValue.constData(), action.toValue.constData(), v), QmlMetaProperty::BypassInterceptor | QmlMetaProperty::DontRemoveBinding); } - QmlBehavior::_ignore = false; } } }; @@ -1805,9 +1805,11 @@ void QmlPropertyAnimation::transition(QmlStateActions &actions, bool useType = (props.isEmpty() && d->defaultToInterpolatorType) ? true : false; + bool targetNeedsReset = false; if (d->userProperty.isValid() && props.isEmpty() && !target()) { props.append(d->userProperty.value.name()); d->target = d->userProperty.value.object(); + targetNeedsReset = true; } PropertyUpdater *data = new PropertyUpdater; @@ -1874,6 +1876,8 @@ void QmlPropertyAnimation::transition(QmlStateActions &actions, } else { delete data; } + if (targetNeedsReset) + d->target = 0; } QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,PropertyAnimation,QmlPropertyAnimation) diff --git a/src/declarative/util/qmltransitionmanager.cpp b/src/declarative/util/qmltransitionmanager.cpp index 3e2e05f..7eaccac 100644 --- a/src/declarative/util/qmltransitionmanager.cpp +++ b/src/declarative/util/qmltransitionmanager.cpp @@ -144,9 +144,9 @@ void QmlTransitionManager::transition(const QList<Action> &list, for (int ii = 0; ii < applyList.size(); ++ii) { const Action &action = applyList.at(ii); if (action.toBinding) { - action.property.setBinding(action.toBinding); + action.property.setBinding(action.toBinding, QmlMetaProperty::BypassInterceptor | QmlMetaProperty::DontRemoveBinding); } else if (!action.event) { - action.property.write(action.toValue); + action.property.write(action.toValue, QmlMetaProperty::BypassInterceptor | QmlMetaProperty::DontRemoveBinding); } else if (action.event->isReversable()) { if (action.reverseEvent) action.event->reverse(); @@ -187,7 +187,7 @@ void QmlTransitionManager::transition(const QList<Action> &list, if (action.toBinding) action.property.setBinding(0); // Make sure this is disabled during the transition - action.property.write(action.fromValue); + action.property.write(action.fromValue, QmlMetaProperty::BypassInterceptor | QmlMetaProperty::DontRemoveBinding); } } @@ -223,7 +223,7 @@ void QmlTransitionManager::transition(const QList<Action> &list, } // Any actions remaining have not been handled by the transition and should - // be applied immediately. We skip applying transitions, as they are all + // be applied immediately. We skip applying bindings, as they are all // applied at the end in applyBindings() to avoid any nastiness mid // transition foreach(const Action &action, applyList) { @@ -232,13 +232,12 @@ void QmlTransitionManager::transition(const QList<Action> &list, action.event->reverse(); else action.event->execute(); - } else if (!action.event) { + } else if (!action.event && !action.toBinding) { action.property.write(action.toValue); } } if (!transition) d->applyBindings(); - } void QmlTransitionManager::cancel() |