A full serving of the Qt State Machine Framework (with a side of SCXML)

After some excellent feedback on Kent and Eskil's state machine framework, and on the old-time Qt-SCXML project, we now present the updated version, with the latest and greatest of both. Qt State Machine Framework Solution 1.1 now includes not only carefully designed API adjustments and bug fixes to the main state/transition classes, but it now also includes the Qt-SCXML functionality, loaded into the Qt State Machine Framework with the QtScriptedStateMachine class.

What does the SCXML part add?

With both SCXML and the State Machine C++ API, you can choose whether your design calls for Qt/C++ style initialization of the state machine, or for loading external SCXML files that access Qt through scripting. The SCXML part also contains a few additions that are not implemented in the C++ API, such as anchors, and the ability to use scripted conditions to guard transitions (even without loading a whole SCXML file, with the QtScriptedTransition class).

Even with the aforementioned features, the SCXML support is a pretty thin layer on top of the C++ State Machine API, as it is basically some standard QXmlStreamReader code for parsing the SCXML file, QtScript for ecmascript transitions and actions, and a couple of additional goodies like menu/message-box and anchors.

Note that there might be a few minor discrepancies between the SCXML spec and what's supported in the implementation. That's due to the fact that the SCXML specification itself is still evolving. We're also participating in the group that makes that happen.

A feature that didn't make it to the release

During the development of this solution, we made an attempt at creating a compiler similar to uic (the QtDesigner form compiler), that would generate C++ Qt State Machine code from the SCXML files, and thus reduce the load time of the state machine. We solicit feedback as to whether such feature is needed.

Note to users of the original Qt-SCXML project

Some of the original features of Qt-SCXML have been enhanced, removed or modified in this spec. For example, instead of using the custom <Qt:property /> tag, we enable an invoke tag <invoke type="q-bindings" /> that does virtually the same thing. See the ported examples and you'll get the picture :)

Also, Qt-SCXML now supports only QtScript, and not the "native" sort-of-expression-syntax it supported before as an alternative. If you're interested in using Qt state-machines without using QtScript at all, We hope that the C++ API is an adequate answer.

If a removed feature from the old Qt-SCXML is extremely close to your heart, please speak your mind!

Feedback Please

Any bug, question, suggestion or interesting use you have: qt-solutions@trolltech.com or here.

Link to the solution: http://www.qtsoftware.com/products/appdev/add-on-products/catalog/4/Utilities/qt-state-machine-framework/

Enjoy :)


Blog Topics:

Comments