I am trying to build a system, which is orchestrated by a main state machine and has different sub state machines for the tasks it is executing. Being a long-time Qt user I looked at the new SCXML implementation in Qt 5.8. However I cannot figure out how to use the API provided with 5.8 to implement sub state machines properly.
My idea is to use a main state machine and then invoke the specific sub state machines in the states of the main state machine. While invoking the sub state machines works I could not figure out how to access them after the top state machine objects emits invokedServicesChanged(..)
I can access the pointer to QScxmlInvokableService
but not to the concerning state machine.
Also the top level state machine object only exposes states and events from the top and not from the invoked state machines. For example topLevelStateMachine->activeStateNames()
only lists the top states.
Looking at Qt's source code I saw that QScxmlInvokableService
is actually a the base class for QScxmlScxmlService
which contains a pointer to the concerning state machine. Unfortunately QScxmlScxmlService
is defined in qscxmlinvokableservice_p.h
which is private as the _p
in the name indicates. So how am I supposed to use the public SCXML API? Am I missing something? IIRC SCXML support was a technical preview in 5.7 but is now included in 5.8 as part of the normal distribution.