diff options
author | Michael Brasser <michael.brasser@nokia.com> | 2010-02-17 02:13:29 (GMT) |
---|---|---|
committer | Michael Brasser <michael.brasser@nokia.com> | 2010-02-18 05:17:15 (GMT) |
commit | 9fb06ea43e807f2bbb40de89e9af5f2cca02212f (patch) | |
tree | d1cdc70f837be31188ab5c23fb7675a5216f3053 /src/declarative/util/qmlanimation.cpp | |
parent | 2ea6cf7976fc9a2d8a67b32ba4854c9eeb583c81 (diff) | |
download | Qt-9fb06ea43e807f2bbb40de89e9af5f2cca02212f.zip Qt-9fb06ea43e807f2bbb40de89e9af5f2cca02212f.tar.gz Qt-9fb06ea43e807f2bbb40de89e9af5f2cca02212f.tar.bz2 |
Transitions and Behaviors should exclusively control their animations.
Don't allow manual control (starting, stopping, etc) of animations in a
Behavior or Transition.
Diffstat (limited to 'src/declarative/util/qmlanimation.cpp')
-rw-r--r-- | src/declarative/util/qmlanimation.cpp | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/src/declarative/util/qmlanimation.cpp b/src/declarative/util/qmlanimation.cpp index cdd5e9a..dd783ca 100644 --- a/src/declarative/util/qmlanimation.cpp +++ b/src/declarative/util/qmlanimation.cpp @@ -249,7 +249,7 @@ void QmlAbstractAnimation::setRunning(bool r) if (d->running == r) return; - if (d->group) { + if (d->group || d->disableUserControl) { qWarning("QmlAbstractAnimation: setRunning() cannot be used on non-root animation nodes"); return; } @@ -308,7 +308,7 @@ void QmlAbstractAnimation::setPaused(bool p) if (d->paused == p) return; - if (d->group) { + if (d->group || d->disableUserControl) { qWarning("QmlAbstractAnimation: setPaused() cannot be used on non-root animation nodes"); return; } @@ -544,15 +544,28 @@ void QmlAbstractAnimation::setTarget(const QmlMetaProperty &p) setRunning(true); } -//we rely on setTarget only being called when used as a value source -//so this function allows us to do the same thing as setTarget without -//that assumption +/* + we rely on setTarget only being called when used as a value source + so this function allows us to do the same thing as setTarget without + that assumption +*/ void QmlAbstractAnimation::setDefaultTarget(const QmlMetaProperty &p) { Q_D(QmlAbstractAnimation); d->defaultProperty = p; } +/* + don't allow start/stop/pause/resume to be manually invoked, + because something else (like a Behavior) already has control + over the animation. +*/ +void QmlAbstractAnimation::setDisableUserControl() +{ + Q_D(QmlAbstractAnimation); + d->disableUserControl = true; +} + void QmlAbstractAnimation::transition(QmlStateActions &actions, QmlMetaProperties &modified, TransitionDirection direction) |