From e823da3a9a09a2982b553f4c8dbe82acb87e8f29 Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Thu, 23 Jul 2009 12:06:07 +1000 Subject: Stricter matching for ParentChangeAction. --- src/declarative/util/qmlanimation.cpp | 4 +++- src/declarative/util/qmlstate.cpp | 8 ++++---- src/declarative/util/qmlstate.h | 2 +- src/declarative/util/qmlstateoperations.cpp | 6 ++++++ src/declarative/util/qmlstateoperations.h | 3 ++- 5 files changed, 16 insertions(+), 7 deletions(-) diff --git a/src/declarative/util/qmlanimation.cpp b/src/declarative/util/qmlanimation.cpp index 7d9e30f..1ea6575 100644 --- a/src/declarative/util/qmlanimation.cpp +++ b/src/declarative/util/qmlanimation.cpp @@ -1153,7 +1153,9 @@ void QmlParentChangeAction::transition(QmlStateActions &actions, Action &action = actions[ii]; //### should we still use target to filter? - if (action.event /*&& action.event->name() == d->parentChange*/) { //### + //### still need type-specific matching + if (action.event + && action.event->typeName() == QLatin1String("ParentChange")) { Action myAction = action; data->reverse = action.reverseEvent; data->actions << myAction; diff --git a/src/declarative/util/qmlstate.cpp b/src/declarative/util/qmlstate.cpp index 2c44c86..1aa7ffe 100644 --- a/src/declarative/util/qmlstate.cpp +++ b/src/declarative/util/qmlstate.cpp @@ -74,7 +74,7 @@ ActionEvent::~ActionEvent() { } -QString ActionEvent::name() const +QString ActionEvent::typeName() const { return QString(); } @@ -360,13 +360,13 @@ void QmlState::apply(QmlStateGroup *group, QmlTransition *trans, QmlState *rever if (action.event) { if (!action.event->isReversable()) continue; - for (jj = 0; jj < d->revertList.count(); ++jj) { + /*for (jj = 0; jj < d->revertList.count(); ++jj) { ActionEvent *event = d->revertList.at(jj).event; - if (event && event->name() == action.event->name()) { + if (event && event->typeName() == action.event->typeName()) { found = true; break; } - } + }*/ //### not a close enough match } else { action.fromBinding = action.property.binding(); diff --git a/src/declarative/util/qmlstate.h b/src/declarative/util/qmlstate.h index 1c0d67f..e453446 100644 --- a/src/declarative/util/qmlstate.h +++ b/src/declarative/util/qmlstate.h @@ -83,7 +83,7 @@ class ActionEvent { public: virtual ~ActionEvent(); - virtual QString name() const; + virtual QString typeName() const; virtual void execute(); virtual bool isReversable(); virtual void reverse(); diff --git a/src/declarative/util/qmlstateoperations.cpp b/src/declarative/util/qmlstateoperations.cpp index dc7fef6..3e114d2 100644 --- a/src/declarative/util/qmlstateoperations.cpp +++ b/src/declarative/util/qmlstateoperations.cpp @@ -142,6 +142,7 @@ QFxItem *QmlParentChange::object() const Q_D(const QmlParentChange); return d->target; } + void QmlParentChange::setObject(QFxItem *target) { Q_D(QmlParentChange); @@ -196,6 +197,11 @@ void QmlParentChange::reverse() d->doChange(d->origParent); } +QString QmlParentChange::typeName() const +{ + return QLatin1String("ParentChange"); +} + class QmlRunScriptPrivate : public QObjectPrivate { public: diff --git a/src/declarative/util/qmlstateoperations.h b/src/declarative/util/qmlstateoperations.h index acbe05e..67cd1cf 100644 --- a/src/declarative/util/qmlstateoperations.h +++ b/src/declarative/util/qmlstateoperations.h @@ -74,6 +74,7 @@ public: virtual void execute(); virtual bool isReversable(); virtual void reverse(); + virtual QString typeName() const; }; class QmlRunScriptPrivate; @@ -94,7 +95,7 @@ public: QString script() const; void setScript(const QString &); - virtual QString name() const; + QString name() const; void setName(const QString &); virtual void execute(); -- cgit v0.12 From e9dde8b58f6a741c10d8b28a463c467f256bdd8f Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Thu, 23 Jul 2009 13:12:44 +1000 Subject: Make sure action events are reversed when not part of a transition. --- src/declarative/util/qmltransitionmanager.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/declarative/util/qmltransitionmanager.cpp b/src/declarative/util/qmltransitionmanager.cpp index 6f1a8e3..4609de8 100644 --- a/src/declarative/util/qmltransitionmanager.cpp +++ b/src/declarative/util/qmltransitionmanager.cpp @@ -196,7 +196,10 @@ void QmlTransitionManager::transition(const QList &list, // transition foreach(const Action &action, applyList) { if (action.event) { - action.event->execute(); + if (action.event->isReversable() && action.reverseEvent) + action.event->reverse(); + else + action.event->execute(); } else { action.property.write(action.toValue); } -- cgit v0.12