summaryrefslogtreecommitdiffstats
path: root/src/imports/statemachine/statemachine.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/imports/statemachine/statemachine.cpp')
-rw-r--r--src/imports/statemachine/statemachine.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/imports/statemachine/statemachine.cpp b/src/imports/statemachine/statemachine.cpp
index ca6c59b6ac..a983644018 100644
--- a/src/imports/statemachine/statemachine.cpp
+++ b/src/imports/statemachine/statemachine.cpp
@@ -51,6 +51,7 @@ StateMachine::StateMachine(QObject *parent)
: QStateMachine(parent), m_completed(false), m_running(false)
{
connect(this, SIGNAL(runningChanged(bool)), SIGNAL(qmlRunningChanged()));
+ connect(this, SIGNAL(childModeChanged()), SLOT(checkChildMode()));
}
bool StateMachine::isRunning() const
@@ -66,6 +67,15 @@ void StateMachine::setRunning(bool running)
m_running = running;
}
+void StateMachine::checkChildMode()
+{
+ if (childMode() != QState::ExclusiveStates) {
+ qmlWarning(this) << "Setting the childMode of a StateMachine to anything else than\n"
+ "QState.ExclusiveStates will result in an invalid state machine,\n"
+ "and can lead to incorrect behavior!";
+ }
+}
+
void StateMachine::componentComplete()
{
if (QStateMachine::initialState() == nullptr && childMode() == QState::ExclusiveStates)
@@ -129,6 +139,9 @@ QQmlListProperty<QObject> StateMachine::children()
erroneous state, the machine will stop executing and an error message will
be printed to the console.
+ \warning Setting the childMode of a StateMachine to anything else than QState::ExclusiveStates
+ will result in an invalid state machine, and can lead to incorrect behavior.
+
\clearfloat
\sa QAbstractState, State, SignalTransition, TimeoutTransition, HistoryState {The Declarative State Machine Framework}