diff options
author | Eskil Abrahamsen Blomfeldt <eblomfel@trolltech.com> | 2009-04-30 08:09:09 (GMT) |
---|---|---|
committer | Eskil Abrahamsen Blomfeldt <eblomfel@trolltech.com> | 2009-04-30 08:09:09 (GMT) |
commit | 18e848faad9289f6052249ef4fe6a20f0654b786 (patch) | |
tree | 760a3ce914e202182ccc33e447c302eb4b3daf75 /src | |
parent | 9e6311a7fd23a9fb7bb3a8a8edc78cddddc3f807 (diff) | |
download | Qt-18e848faad9289f6052249ef4fe6a20f0654b786.zip Qt-18e848faad9289f6052249ef4fe6a20f0654b786.tar.gz Qt-18e848faad9289f6052249ef4fe6a20f0654b786.tar.bz2 |
When restoring properties in descendants of a state which assigns it a value,
the property should be restored to the value assigned by the ancestor state.
When restoreProperties is on, assigning a value in a state means it will have
that value as long as the state is active, unless an active state deeper in the
hierarchy assigns it a different value. This is basically a stack of "initial"
values, but implemented using the parent hierarchy of the state instead.
Diffstat (limited to 'src')
-rw-r--r-- | src/corelib/statemachine/qstatemachine.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/corelib/statemachine/qstatemachine.cpp b/src/corelib/statemachine/qstatemachine.cpp index 81d65d5..0ebc993 100644 --- a/src/corelib/statemachine/qstatemachine.cpp +++ b/src/corelib/statemachine/qstatemachine.cpp @@ -658,13 +658,16 @@ void QStateMachinePrivate::applyProperties(const QList<QAbstractTransition*> &tr } // Remove pending restorables for all parent states to avoid restoring properties - // before the state that assigned them is exited. + // before the state that assigned them is exited. If state does not explicitly + // assign a property which is assigned by the parent, it inherits the parent's assignment. 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)); + int c = pendingRestorables.remove(RestorableId(assn.object, assn.propertyName)); + if (c > 0) + propertyAssignmentsForState[s].append(assn); } } } |