summaryrefslogtreecommitdiffstats
path: root/src/declarative/util/qmltransition.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/declarative/util/qmltransition.cpp')
-rw-r--r--src/declarative/util/qmltransition.cpp39
1 files changed, 13 insertions, 26 deletions
diff --git a/src/declarative/util/qmltransition.cpp b/src/declarative/util/qmltransition.cpp
index 22826ce..e90fc20 100644
--- a/src/declarative/util/qmltransition.cpp
+++ b/src/declarative/util/qmltransition.cpp
@@ -82,10 +82,11 @@ class QmlTransitionPrivate : public QObjectPrivate
{
Q_DECLARE_PUBLIC(QmlTransition)
public:
- QmlTransitionPrivate() : fromState(QLatin1String("*")), toState(QLatin1String("*"))
- , reversed(false), reversible(false), endState(0)
+ QmlTransitionPrivate()
+ : fromState(QLatin1String("*")), toState(QLatin1String("*")),
+ reversed(false), reversible(false), endState(0)
{
- animations.parent = this;
+ group.trans = this;
}
QString fromState;
@@ -95,32 +96,20 @@ public:
ParallelAnimationWrapper group;
QmlTransitionManager *endState;
- void init()
- {
- group.trans = this;
- }
-
void complete()
{
endState->complete();
}
-
- class AnimationList : public QmlConcreteList<QmlAbstractAnimation *>
- {
- public:
- AnimationList() : parent(0) {}
- virtual void append(QmlAbstractAnimation *a);
- virtual void clear() { QmlConcreteList<QmlAbstractAnimation *>::clear(); } //###
-
- QmlTransitionPrivate *parent;
- };
- AnimationList animations;
+ static void append_animation(QmlListProperty<QmlAbstractAnimation> *list, QmlAbstractAnimation *a);
+ QList<QmlAbstractAnimation *> animations;
};
-void QmlTransitionPrivate::AnimationList::append(QmlAbstractAnimation *a)
+void QmlTransitionPrivate::append_animation(QmlListProperty<QmlAbstractAnimation> *list, QmlAbstractAnimation *a)
{
- QmlConcreteList<QmlAbstractAnimation *>::append(a);
- parent->group.addAnimation(a->qtAnimation());
+ QmlTransition *q = static_cast<QmlTransition *>(list->object);
+ q->d_func()->animations.append(a);
+ q->d_func()->group.addAnimation(a->qtAnimation());
+ a->setDisableUserControl();
}
void ParallelAnimationWrapper::updateState(QAbstractAnimation::State newState, QAbstractAnimation::State oldState)
@@ -139,8 +128,6 @@ QML_DEFINE_TYPE(Qt,4,6,Transition,QmlTransition)
QmlTransition::QmlTransition(QObject *parent)
: QObject(*(new QmlTransitionPrivate), parent)
{
- Q_D(QmlTransition);
- d->init();
}
QmlTransition::~QmlTransition()
@@ -250,10 +237,10 @@ void QmlTransition::setToState(const QString &t)
and assign that to animations the animations property.
\default
*/
-QmlList<QmlAbstractAnimation *>* QmlTransition::animations()
+QmlListProperty<QmlAbstractAnimation> QmlTransition::animations()
{
Q_D(QmlTransition);
- return &d->animations;
+ return QmlListProperty<QmlAbstractAnimation>(this, &d->animations, QmlTransitionPrivate::append_animation);
}
QT_END_NAMESPACE