Solved Transitions between child states of different composite states in DSM-Framework
-
According to the last chapter of The State Machine Framework, when nesting state machines, source and target states of transitions are limited to states of the same state machine instance:
(...) States of the child state machine cannot be specified as targets of transitions in the parent state machine; only the child state machine itself can. Conversely, states of the parent state machine cannot be specified as targets of transitions in the child state machine.(...)
Does The Declarative State Machine Framework have these same limitation?
My experiments show that it is possible to create a transition from a child state of one composite state to another state that is on the same level than the composite state, but I don't know if this works on purpose or accidentially:
StateMachine { initialState: father State { id: father initialState: child onEntered: console.log("Entered: father"); onExited: console.log("Exited: father"); State { id: child onEntered: console.log("Entered: child"); onExited: console.log("Exited state child"); TimeoutTransition { /* transition to outer state */ targetState: uncle timeout: 5000 } } } State { id: uncle onEntered: console.log("Entered: uncle"); onExited: console.log("Exited: uncle"); } }
-
Hi! The C++ and QML statemachines have a different code base and there are some differences in behaviour. Regarding your question, the documentation says:
A transition can have any state as its target irrespective of where the target state is in the state hierarchy.
So indeed it seems to be on purpose.
-
Thanks for the quick and helpful response.
Seems I've missed that line in the documentation.