summaryrefslogtreecommitdiffstats
path: root/src/declarative
diff options
context:
space:
mode:
authorMichael Brasser <michael.brasser@nokia.com>2010-02-17 03:21:46 (GMT)
committerMichael Brasser <michael.brasser@nokia.com>2010-02-18 05:17:15 (GMT)
commit05cbd2fe4b5d9cbdef3be52b6d14d2d20255641a (patch)
treedecbeb2a21a1b022bf5f3d5773935a33691c9ca8 /src/declarative
parent9fb06ea43e807f2bbb40de89e9af5f2cca02212f (diff)
downloadQt-05cbd2fe4b5d9cbdef3be52b6d14d2d20255641a.zip
Qt-05cbd2fe4b5d9cbdef3be52b6d14d2d20255641a.tar.gz
Qt-05cbd2fe4b5d9cbdef3be52b6d14d2d20255641a.tar.bz2
Fix bugs and add tests related to manual start/stop control of animations.
This better enforces the restriction on starting an animation that is not top-level, or is part of a Transition or Behavior.
Diffstat (limited to 'src/declarative')
-rw-r--r--src/declarative/util/qmlanimation.cpp19
-rw-r--r--src/declarative/util/qmlanimation_p_p.h3
2 files changed, 12 insertions, 10 deletions
diff --git a/src/declarative/util/qmlanimation.cpp b/src/declarative/util/qmlanimation.cpp
index dd783ca..4b33af0 100644
--- a/src/declarative/util/qmlanimation.cpp
+++ b/src/declarative/util/qmlanimation.cpp
@@ -243,8 +243,12 @@ QmlMetaProperty QmlAbstractAnimationPrivate::createProperty(QObject *obj, const
void QmlAbstractAnimation::setRunning(bool r)
{
Q_D(QmlAbstractAnimation);
- if (r == false)
- d->avoidPropertyValueSourceStart = true;
+ if (!d->componentComplete) {
+ d->running = r;
+ if (r == false)
+ d->avoidPropertyValueSourceStart = true;
+ return;
+ }
if (d->running == r)
return;
@@ -266,10 +270,7 @@ void QmlAbstractAnimation::setRunning(bool r)
this, SLOT(timelineComplete()));
d->connectedTimeLine = true;
}
- if (d->componentComplete)
- d->commence();
- else
- d->startOnCompletion = true;
+ d->commence();
emit started();
} else {
if (d->alwaysRunToEnd) {
@@ -331,9 +332,11 @@ void QmlAbstractAnimation::classBegin()
void QmlAbstractAnimation::componentComplete()
{
Q_D(QmlAbstractAnimation);
- if (d->startOnCompletion)
- d->commence();
d->componentComplete = true;
+ if (d->running) {
+ d->running = false;
+ setRunning(true);
+ }
}
/*!
diff --git a/src/declarative/util/qmlanimation_p_p.h b/src/declarative/util/qmlanimation_p_p.h
index 288aaa8..ee0c291 100644
--- a/src/declarative/util/qmlanimation_p_p.h
+++ b/src/declarative/util/qmlanimation_p_p.h
@@ -209,7 +209,7 @@ class QmlAbstractAnimationPrivate : public QObjectPrivate
public:
QmlAbstractAnimationPrivate()
: running(false), paused(false), alwaysRunToEnd(false), repeat(false),
- connectedTimeLine(false), componentComplete(true), startOnCompletion(false),
+ connectedTimeLine(false), componentComplete(true),
avoidPropertyValueSourceStart(false), disableUserControl(false), group(0) {}
bool running:1;
@@ -218,7 +218,6 @@ public:
bool repeat:1;
bool connectedTimeLine:1;
bool componentComplete:1;
- bool startOnCompletion:1;
bool avoidPropertyValueSourceStart:1;
bool disableUserControl:1;