diff options
Diffstat (limited to 'src/declarative')
-rw-r--r-- | src/declarative/util/qmlanimation.cpp | 22 | ||||
-rw-r--r-- | src/declarative/util/qmlpackage.cpp | 24 |
2 files changed, 45 insertions, 1 deletions
diff --git a/src/declarative/util/qmlanimation.cpp b/src/declarative/util/qmlanimation.cpp index 4c5015d..f5333a6 100644 --- a/src/declarative/util/qmlanimation.cpp +++ b/src/declarative/util/qmlanimation.cpp @@ -1032,15 +1032,26 @@ void QmlPropertyAction::transition(QmlStateActions &actions, QmlSetPropertyAnimationAction *data = new QmlSetPropertyAnimationAction; + bool hasExplicit = false; if (hasTarget && d->value.isValid()) { Action myAction; myAction.property = d->createProperty(target(), d->propertyName, this); if (myAction.property.isValid()) { myAction.toValue = d->value; data->actions << myAction; + hasExplicit = true; + for (int ii = 0; ii < actions.count(); ++ii) { + Action &action = actions[ii]; + if (action.property.object() == myAction.property.object() && + myAction.property.name() == action.property.name()) { + modified << action.property; + break; //### any chance there could be multiples? + } + } } } + if (!hasExplicit) for (int ii = 0; ii < actions.count(); ++ii) { Action &action = actions[ii]; @@ -2219,6 +2230,7 @@ void QmlPropertyAnimation::transition(QmlStateActions &actions, data->interpolator = d->interpolator; data->reverse = direction == Backward ? true : false; + bool hasExplicit = false; //an explicit animation has been specified if (hasTarget && d->toIsDefined) { Action myAction; @@ -2231,9 +2243,19 @@ void QmlPropertyAnimation::transition(QmlStateActions &actions, d->convertVariant(d->to, d->interpolatorType ? d->interpolatorType : myAction.property.propertyType()); myAction.toValue = d->to; data->actions << myAction; + hasExplicit = true; + for (int ii = 0; ii < actions.count(); ++ii) { + Action &action = actions[ii]; + if (action.property.object() == myAction.property.object() && + myAction.property.name() == action.property.name()) { + modified << action.property; + break; //### any chance there could be multiples? + } + } } } + if (!hasExplicit) for (int ii = 0; ii < actions.count(); ++ii) { Action &action = actions[ii]; diff --git a/src/declarative/util/qmlpackage.cpp b/src/declarative/util/qmlpackage.cpp index f9238ca..3214dc8 100644 --- a/src/declarative/util/qmlpackage.cpp +++ b/src/declarative/util/qmlpackage.cpp @@ -42,6 +42,7 @@ #include "qmlpackage_p.h" #include <private/qobject_p.h> +#include "private/qmlguard_p.h" QT_BEGIN_NAMESPACE @@ -50,7 +51,28 @@ class QmlPackagePrivate : public QObjectPrivate public: QmlPackagePrivate() {} - QmlConcreteList<QObject *> dataList; + class DataList; + struct DataGuard : public QmlGuard<QObject> + { + DataGuard(QObject *obj, DataList *l) : list(l) { (QmlGuard<QObject>&)*this = obj; } + DataList *list; + void objectDestroyed(QObject *) { + // we assume priv will always be destroyed after objectDestroyed calls + list->removeOne(*this); + } + }; + + class DataList : public QList<DataGuard>, public QmlList<QObject*> + { + public: + virtual void append(QObject* v) { QList<DataGuard>::append(DataGuard(v, this)); } + virtual void insert(int i, QObject* v) { QList<DataGuard>::insert(i, DataGuard(v, this)); } + virtual void clear() { QList<DataGuard>::clear(); } + virtual QObject* at(int i) const { return QList<DataGuard>::at(i); } + virtual void removeAt(int i) { QList<DataGuard>::removeAt(i); } + virtual int count() const { return QList<DataGuard>::count(); } + }; + DataList dataList; }; class QmlPackageAttached : public QObject |