summaryrefslogtreecommitdiffstats
path: root/src/declarative/util/qmlanimation.cpp
diff options
context:
space:
mode:
authorMichael Brasser <michael.brasser@nokia.com>2009-12-07 03:22:25 (GMT)
committerMichael Brasser <michael.brasser@nokia.com>2009-12-07 03:22:25 (GMT)
commit55a3fda3baf545cc7fbfa6b2c00705be40a7319b (patch)
tree04f82179b29b46b3fd540cab4dfea54f7ea377e8 /src/declarative/util/qmlanimation.cpp
parent560d32ddd80d5c6b21cd39ae93ea3f580da613da (diff)
downloadQt-55a3fda3baf545cc7fbfa6b2c00705be40a7319b.zip
Qt-55a3fda3baf545cc7fbfa6b2c00705be40a7319b.tar.gz
Qt-55a3fda3baf545cc7fbfa6b2c00705be40a7319b.tar.bz2
Move target/property functions to their appropriate classes.
Diffstat (limited to 'src/declarative/util/qmlanimation.cpp')
-rw-r--r--src/declarative/util/qmlanimation.cpp138
1 files changed, 91 insertions, 47 deletions
diff --git a/src/declarative/util/qmlanimation.cpp b/src/declarative/util/qmlanimation.cpp
index 0143791..8afe667 100644
--- a/src/declarative/util/qmlanimation.cpp
+++ b/src/declarative/util/qmlanimation.cpp
@@ -422,50 +422,6 @@ void QmlAbstractAnimation::setGroup(QmlAnimationGroup *g)
setParent(g);
}
-QObject *QmlAbstractAnimation::target() const
-{
- Q_D(const QmlAbstractAnimation);
- return d->target;
-}
-
-void QmlAbstractAnimation::setTarget(QObject *o)
-{
- Q_D(QmlAbstractAnimation);
- if (d->target == o)
- return;
-
- d->target = o;
- if (d->target && !d->propertyName.isEmpty()) {
- d->userProperty = d->createProperty(d->target, d->propertyName, this);
- } else {
- d->userProperty.invalidate();
- }
-
- emit targetChanged(d->target, d->propertyName);
-}
-
-QString QmlAbstractAnimation::property() const
-{
- Q_D(const QmlAbstractAnimation);
- return d->propertyName;
-}
-
-void QmlAbstractAnimation::setProperty(const QString &n)
-{
- Q_D(QmlAbstractAnimation);
- if (d->propertyName == n)
- return;
-
- d->propertyName = n;
- if (d->target && !d->propertyName.isEmpty()) {
- d->userProperty = d->createProperty(d->target, d->propertyName, this);
- } else {
- d->userProperty.invalidate();
- }
-
- emit targetChanged(d->target, d->propertyName);
-}
-
/*!
\qmlmethod Animation::start()
\brief Starts the animation.
@@ -886,6 +842,28 @@ void QmlPropertyActionPrivate::init()
is being used. Refer to the \l animation documentation for details.
*/
+QObject *QmlPropertyAction::target() const
+{
+ Q_D(const QmlPropertyAction);
+ return d->target;
+}
+
+void QmlPropertyAction::setTarget(QObject *o)
+{
+ Q_D(QmlPropertyAction);
+ if (d->target == o)
+ return;
+
+ d->target = o;
+ if (d->target && !d->propertyName.isEmpty()) {
+ d->userProperty = d->createProperty(d->target, d->propertyName, this);
+ } else {
+ d->userProperty.invalidate();
+ }
+
+ emit targetChanged(d->target, d->propertyName);
+}
+
/*!
\qmlproperty string PropertyAction::property
This property holds an explicit property to animated.
@@ -894,6 +872,28 @@ void QmlPropertyActionPrivate::init()
is being used. Refer to the \l animation documentation for details.
*/
+QString QmlPropertyAction::property() const
+{
+ Q_D(const QmlPropertyAction);
+ return d->propertyName;
+}
+
+void QmlPropertyAction::setProperty(const QString &n)
+{
+ Q_D(QmlPropertyAction);
+ if (d->propertyName == n)
+ return;
+
+ d->propertyName = n;
+ if (d->target && !d->propertyName.isEmpty()) {
+ d->userProperty = d->createProperty(d->target, d->propertyName, this);
+ } else {
+ d->userProperty.invalidate();
+ }
+
+ emit targetChanged(d->target, d->propertyName);
+}
+
/*!
\qmlproperty string PropertyAction::matchProperties
This property holds a comma-separated list of property names this action
@@ -1445,10 +1445,10 @@ void QmlSequentialAnimation::transition(QmlStateActions &actions,
}
//needed for Behavior
- if (d->userProperty.isValid() && d->propertyName.isEmpty() && !target()) {
+ if (d->userProperty.isValid()) {
for (int i = 0; i < d->animations.count(); ++i)
d->animations.at(i)->setTarget(d->userProperty);
- }
+ }
for (int ii = from; ii < d->animations.count() && ii >= 0; ii += inc) {
d->animations.at(ii)->transition(actions, modified, direction);
@@ -1517,7 +1517,7 @@ void QmlParallelAnimation::transition(QmlStateActions &actions,
Q_D(QmlAnimationGroup);
//needed for Behavior
- if (d->userProperty.isValid() && d->propertyName.isEmpty() && !target()) {
+ if (d->userProperty.isValid()) {
for (int i = 0; i < d->animations.count(); ++i)
d->animations.at(i)->setTarget(d->userProperty);
}
@@ -1881,6 +1881,28 @@ void QmlPropertyAnimation::setEasing(const QString &e)
\sa property matchTargets
*/
+QObject *QmlPropertyAnimation::target() const
+{
+ Q_D(const QmlPropertyAnimation);
+ return d->target;
+}
+
+void QmlPropertyAnimation::setTarget(QObject *o)
+{
+ Q_D(QmlPropertyAnimation);
+ if (d->target == o)
+ return;
+
+ d->target = o;
+ if (d->target && !d->propertyName.isEmpty()) {
+ d->userProperty = d->createProperty(d->target, d->propertyName, this);
+ } else {
+ d->userProperty.invalidate();
+ }
+
+ emit targetChanged(d->target, d->propertyName);
+}
+
/*!
\qmlproperty string PropertyAnimation::property
This property holds an explicit property name to animate.
@@ -1891,6 +1913,28 @@ void QmlPropertyAnimation::setEasing(const QString &e)
\sa target matchProperties
*/
+QString QmlPropertyAnimation::property() const
+{
+ Q_D(const QmlPropertyAnimation);
+ return d->propertyName;
+}
+
+void QmlPropertyAnimation::setProperty(const QString &n)
+{
+ Q_D(QmlPropertyAnimation);
+ if (d->propertyName == n)
+ return;
+
+ d->propertyName = n;
+ if (d->target && !d->propertyName.isEmpty()) {
+ d->userProperty = d->createProperty(d->target, d->propertyName, this);
+ } else {
+ d->userProperty.invalidate();
+ }
+
+ emit targetChanged(d->target, d->propertyName);
+}
+
/*!
\qmlproperty string PropertyAnimation::matchProperties
This property holds a comma-separated list of property names this animation