Important: Please read the Qt Code of Conduct -

QtScxml State Machine access available states and transitions?

  • Hello,

    We are looking for a way through the public API to access available states and there transitions. We have found this can be accomplished leveraging the private headers below but are not part of the public API. Is it possible to get this information through the public API?

    #include <private/qscxmlstatemachineinfo_p.h>
    #include <private/qscxmlstatemachine_p.h>

  • Lifetime Qt Champion


    If everything that you are looking for is in the private headers then no, you cannot access that with the public API.

  • Is there some way to extract it from the QScxmlDataModel?

  • Lifetime Qt Champion

    It does not look like it is.

    What is your exact goal ?

  • We have a development GUI which we are leveraging this to provide the user the option to manually trigger different transitions from the active state. So we need to be able to get the available transitions for a active state and what conditions must be meet for each transition or if it could give the current allowed transitions would be sufficient. Then when a transition is requested through the GUI we need feedback on if the transition was successful.

  • Lifetime Qt Champion

    You might want to check KDAB's GammaRay. IIRC they have a tool to inspect state machines.

Log in to reply