From 0cd34a0c39bf443f1ea6f6868ac6fbc0fc2c9e6d Mon Sep 17 00:00:00 2001 From: Erik Verbruggen Date: Fri, 19 Jun 2015 11:11:31 +0200 Subject: 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 --- src/corelib/statemachine/qstate.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/corelib/statemachine') 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()); -- cgit v1.2.3