Deep Tech Qt Roadmap Tomorrow Success

Qt SCXML: State Machines Made Easier


Berlin Room October 20, 2016 4:00 pm - 4:55 pm

Bookmark and Share

Ulf Hermann

State Chart XML (SCXML) is a common format to specify state machines. It has been standardized by the W3C and there are many applications that produce or process it. State charts provide a graphical way of modeling how a system reacts to stimuli. This is done by defining the possible states that the system can be in, and how the system can move from one state to another. State charts offer a very concise representation of business logic, and limit the potential for unexpected behavior. Qt 5.7 comes with a technical preview of Qt SCXML, a module to integrate state charts specified in SCXML into your application, and execute them in accordance to the W3C specification. This way a Qt application can be driven from a state chart, rather than from business logic expressed in C++ or QML. With Qt SCXML, SCXML documents can be compiled into C++, which can then be readily integrated into any Qt application. Alternately, SCXML documents can also be dynamically loaded and interpreted at run time. In both cases, states are exposed via Qt properties, so that QML properties can effortlessly be bound to them. It is thus very easy to attach a Qt Quick UI to an existing, or newly written, state machine. The talk will show the full workflow of creating a state machine in a visual design tool, integrating it into a project with Qt Creator, adding a custom data model, and attaching a user interface to it, using QML and Qt Quick.