summaryrefslogtreecommitdiffstats
path: root/src/corelib
diff options
context:
space:
mode:
authorErik Verbruggen <erik.verbruggen@digia.com>2015-06-19 11:11:31 +0200
committerErik Verbruggen <erik.verbruggen@theqtcompany.com>2015-07-23 07:44:35 +0000
commit0cd34a0c39bf443f1ea6f6868ac6fbc0fc2c9e6d (patch)
tree9f27eb47ee761bb973e1c65dd0fdb0555a3979f8 /src/corelib
parent67638d08b482150f2bace66b4836e278b73cc214 (diff)
StateMachine: remove initial state for parallel states.
A parallel state cannot have an initial state, as all children of the parallel state will be entered. Setting such an initial state on a QState marked as ParallelStates would already produce a warning and ignore the initial state. Now any initial state that has been set before changing the child-mode to ParallelStates will also produce a warning and remove the previously set initial state. Change-Id: Ie5fcd44b03516744f785f2d1880bf806918c44d4 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>
Diffstat (limited to 'src/corelib')
-rw-r--r--src/corelib/statemachine/qstate.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/corelib/statemachine/qstate.cpp b/src/corelib/statemachine/qstate.cpp
index 5abbbfd9ad..3b84230cb2 100644
--- a/src/corelib/statemachine/qstate.cpp
+++ b/src/corelib/statemachine/qstate.cpp
@@ -518,6 +518,14 @@ QState::ChildMode QState::childMode() const
void QState::setChildMode(ChildMode mode)
{
Q_D(QState);
+
+ if (mode == QState::ParallelStates && d->initialState) {
+ qWarning("QState::setChildMode: setting the child-mode of state %p to "
+ "parallel removes the initial state", this);
+ d->initialState = Q_NULLPTR;
+ emit initialStateChanged(QState::QPrivateSignal());
+ }
+
if (d->childMode != mode) {
d->childMode = mode;
emit childModeChanged(QState::QPrivateSignal());