summaryrefslogtreecommitdiffstats
path: root/src/corelib/statemachine/qstatemachine.cpp
diff options
context:
space:
mode:
authorErik Verbruggen <erik.verbruggen@theqtcompany.com>2015-04-13 13:54:20 +0200
committerErik Verbruggen <erik.verbruggen@theqtcompany.com>2015-05-04 12:49:28 +0000
commitc07f5b801bd6a94fe862073eb1f1965115a56385 (patch)
tree13fbe91bc46fed866abdd8a22aa27529a6f550b1 /src/corelib/statemachine/qstatemachine.cpp
parentbd15b23987e9d6d1f42fa8987e5c1ff5a1eeee8b (diff)
QStateMachine: add internal transitions.
The behavior of "external" and "internal" transitions is identical, except in the case of a transition whose source state is a compound state and whose target(s) is a descendant of the source. In such a case, an internal transition will not exit and re-enter its source state, while an external one will. [ChangeLog][State machine] Added support for internal transitions. Change-Id: I9efb1e7368ee52aa2544eb84709a00ae3d5350d3 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>
Diffstat (limited to 'src/corelib/statemachine/qstatemachine.cpp')
-rw-r--r--src/corelib/statemachine/qstatemachine.cpp25
1 files changed, 12 insertions, 13 deletions
diff --git a/src/corelib/statemachine/qstatemachine.cpp b/src/corelib/statemachine/qstatemachine.cpp
index d91b4ba14a..6e36f93c40 100644
--- a/src/corelib/statemachine/qstatemachine.cpp
+++ b/src/corelib/statemachine/qstatemachine.cpp
@@ -889,23 +889,22 @@ QAbstractState *QStateMachinePrivate::getTransitionDomain(QAbstractTransition *t
if (cache->transitionDomain(t, &domain))
return domain;
-#if 0
- // Qt only has external transitions, so skip the special case for the internal transitions
- if (QState *tSource = t->sourceState()) {
- if (isCompound(tSource)) {
- bool allDescendants = true;
- foreach (QAbstractState *s, effectiveTargetStates) {
- if (!isDescendant(s, tSource)) {
- allDescendants = false;
- break;
+ if (t->transitionType() == QAbstractTransition::InternalTransition) {
+ if (QState *tSource = t->sourceState()) {
+ if (isCompound(tSource)) {
+ bool allDescendants = true;
+ foreach (QAbstractState *s, effectiveTargetStates) {
+ if (!isDescendant(s, tSource)) {
+ allDescendants = false;
+ break;
+ }
}
- }
- if (allDescendants)
- return tSource;
+ if (allDescendants)
+ return tSource;
+ }
}
}
-#endif
QList<QAbstractState *> states(effectiveTargetStates);
if (QAbstractState *src = t->sourceState())