summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlan Alpert <alan.alpert@nokia.com>2009-07-28 03:45:41 (GMT)
committerAlan Alpert <alan.alpert@nokia.com>2009-07-28 03:45:41 (GMT)
commitf7ddf86cb2bab6ca726ef9c8c091b83a12cbf9ed (patch)
treee38860bcd3231d0b792fca6dea4da8621a2167eb
parenta4f00b20910a345cb0d6feb4916faac65957c9e1 (diff)
parent23adda357713582df8d41ec08554359b452c4e55 (diff)
downloadQt-f7ddf86cb2bab6ca726ef9c8c091b83a12cbf9ed.zip
Qt-f7ddf86cb2bab6ca726ef9c8c091b83a12cbf9ed.tar.gz
Qt-f7ddf86cb2bab6ca726ef9c8c091b83a12cbf9ed.tar.bz2
Merge branch 'kinetic-declarativeui' of git@scm.dev.nokia.troll.no:qt/kinetic into kinetic-declarativeui
-rw-r--r--src/declarative/util/qmlstate.cpp28
-rw-r--r--src/declarative/util/qmlstate.h1
-rw-r--r--src/declarative/util/qmlstateoperations.cpp10
-rw-r--r--src/declarative/util/qmlstateoperations.h1
4 files changed, 35 insertions, 5 deletions
diff --git a/src/declarative/util/qmlstate.cpp b/src/declarative/util/qmlstate.cpp
index c41c31a..af60a6f 100644
--- a/src/declarative/util/qmlstate.cpp
+++ b/src/declarative/util/qmlstate.cpp
@@ -110,6 +110,11 @@ void ActionEvent::clearReverseBindings()
{
}
+bool ActionEvent::override(ActionEvent *other)
+{
+ return false;
+}
+
/*!
\internal
*/
@@ -378,13 +383,15 @@ 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->typeName() == action.event->typeName()) {
- found = true;
- break;
+ if (action.event->override(event)) {
+ found = true;
+ break;
+ }
}
- }*/ //### not a close enough match
+ }
} else {
action.fromBinding = action.property.binding();
@@ -417,7 +424,18 @@ void QmlState::apply(QmlStateGroup *group, QmlTransition *trans, QmlState *rever
// into this state need to be translated into apply actions
for (int ii = 0; ii < d->revertList.count(); ++ii) {
bool found = false;
- if (!d->revertList.at(ii).event) { //### corresponding test for events?
+ if (d->revertList.at(ii).event) {
+ ActionEvent *event = d->revertList.at(ii).event;
+ if (!event->isReversable())
+ continue;
+ for (int jj = 0; !found && jj < applyList.count(); ++jj) {
+ const Action &action = applyList.at(jj);
+ if (action.event && action.event->typeName() == event->typeName()) {
+ if (action.event->override(event))
+ found = true;
+ }
+ }
+ } else {
for (int jj = 0; !found && jj < applyList.count(); ++jj) {
const Action &action = applyList.at(jj);
if (action.property == d->revertList.at(ii).property)
diff --git a/src/declarative/util/qmlstate.h b/src/declarative/util/qmlstate.h
index 7b3021b..7c62768 100644
--- a/src/declarative/util/qmlstate.h
+++ b/src/declarative/util/qmlstate.h
@@ -96,6 +96,7 @@ public:
virtual bool changesBindings();
virtual void clearForwardBindings();
virtual void clearReverseBindings();
+ virtual bool override(ActionEvent*other);
};
class QmlStateGroup;
diff --git a/src/declarative/util/qmlstateoperations.cpp b/src/declarative/util/qmlstateoperations.cpp
index e2cbae4..3d03c34 100644
--- a/src/declarative/util/qmlstateoperations.cpp
+++ b/src/declarative/util/qmlstateoperations.cpp
@@ -202,6 +202,16 @@ QString QmlParentChange::typeName() const
return QLatin1String("ParentChange");
}
+bool QmlParentChange::override(ActionEvent*other)
+{
+ Q_D(QmlParentChange);
+ if (other->typeName() != QLatin1String("ParentChange"))
+ return false;
+ if (QmlParentChange *otherPC = static_cast<QmlParentChange*>(other))
+ return (d->target == otherPC->object());
+ return false;
+}
+
class QmlRunScriptPrivate : public QObjectPrivate
{
public:
diff --git a/src/declarative/util/qmlstateoperations.h b/src/declarative/util/qmlstateoperations.h
index f595e16..4bd17a0 100644
--- a/src/declarative/util/qmlstateoperations.h
+++ b/src/declarative/util/qmlstateoperations.h
@@ -76,6 +76,7 @@ public:
virtual bool isReversable();
virtual void reverse();
virtual QString typeName() const;
+ virtual bool override(ActionEvent*other);
};
class QmlRunScriptPrivate;