summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEskil Abrahamsen Blomfeldt <eblomfel@trolltech.com>2009-04-30 07:49:09 (GMT)
committerEskil Abrahamsen Blomfeldt <eblomfel@trolltech.com>2009-04-30 07:49:09 (GMT)
commit9e6311a7fd23a9fb7bb3a8a8edc78cddddc3f807 (patch)
treeecc66b0e452f785fb091a2d45245d2911a481b0c /src
parent0d33e6e464c324d1b43b08ce7ac0dcd4c216d17e (diff)
downloadQt-9e6311a7fd23a9fb7bb3a8a8edc78cddddc3f807.zip
Qt-9e6311a7fd23a9fb7bb3a8a8edc78cddddc3f807.tar.gz
Qt-9e6311a7fd23a9fb7bb3a8a8edc78cddddc3f807.tar.bz2
The intuitive interpretation of RestoreProperties is that a value is
potentially restored once the state that set it is exited. So if you have a parent state P which sets 'foo' and then several child states of P, the property should not be restored as long as P is active, regardless of which transitions are taken inside P and what properties are being assigned there. Before, we would restore the property when we entered a state that did not assign it, ignoring what properties where being assigned in the parent.
Diffstat (limited to 'src')
-rw-r--r--src/corelib/statemachine/qstatemachine.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/corelib/statemachine/qstatemachine.cpp b/src/corelib/statemachine/qstatemachine.cpp
index 9060f0e..81d65d5 100644
--- a/src/corelib/statemachine/qstatemachine.cpp
+++ b/src/corelib/statemachine/qstatemachine.cpp
@@ -656,6 +656,17 @@ void QStateMachinePrivate::applyProperties(const QList<QAbstractTransition*> &tr
pendingRestorables.remove(RestorableId(assn.object, assn.propertyName));
propertyAssignmentsForState[s].append(assn);
}
+
+ // Remove pending restorables for all parent states to avoid restoring properties
+ // before the state that assigned them is exited.
+ QState *parentState = s;
+ while (parentState = parentState->parentState()) {
+ assignments = QStatePrivate::get(parentState)->propertyAssignments;
+ for (int j=0; j<assignments.size(); ++j) {
+ const QPropertyAssignment &assn = assignments.at(j);
+ pendingRestorables.remove(RestorableId(assn.object, assn.propertyName));
+ }
+ }
}
if (!pendingRestorables.isEmpty()) {
QAbstractState *s;