Important: Please read the Qt Code of Conduct -

Implementing a custom data model for SCXML

  • I'm using Qt with an SCXML state machine. I want to use the native Qt SCXML interpreter via QScxmlStateMachine. However, Qt only supports Null, EcmaScript, and C++ data models for SCXML. My state machine has a custom data model.

    I would like to subclass QScxmlDataModel to support my state machine. I can see how implementing the setup(), hasScxmlProperty(), setScxmlProperty(), and scxmlProperty() functions would allow setting/getting values from the data model. However, I don't see how to make it so that expressions and other model-specific items—such as with <transition cond="..."> or <script>...</script>—will properly be evaluated in my custom data model.

    How can I make a custom data model that knows how to do more than just get/set properties?

  • Answered on StackOverflow. The key is that there are many functions hidden from the documentation that need to be overridden, like evaluateToString().

Log in to reply