SCXML now on public Gitorious, in sync with Qt mainline

For those of you that enjoy writing relatively complex yet manageable apps without needing too much native code, the SCXML enabler that works on top of the Qt State Machine Framework is now active on public Gitorious, at We're opening the repository after a few bug-fixes and improvements we found in other Git repositories - we want to enable people to contribute them back!

The old examples still work, and the code gets smaller and smaller as most of the functionality is already in Qt, under a C++ API; since QStateMachine was developed using the SCXML algorithm and semantics, the QScxml class mainly includes  some XML parsing and QtScript preparations - definitely not rocket science  :)

The SCXML enabler on top of QStateMachine adds the following functionalities:

  • Having QtScript-based guard conditions for transitions. For example, this simple log-in functionality, which (hopefully) explains itself:<transition event="q-signal:loginButton.clicked()" cond="passwordEdit.text == currentUserInfo.password" target="logged_in" />
  • Evaluating scripts on entry/exit/transition, and in general utilizing a single QScriptEngine for the state-machine which is a small detail that makes a big difference.
  • Anchors for generic "go back" functionality, which is different from history states, that don't maintain a stack (see mediaplayer example).
  • Using <invoke> to extend the functionality, like the message-boxes in the blackjack example.
  • Assigning dynamic property values to states, based on ECMAscript, as the C++ QStateMachine only allows for static assignments.
  • State-machine timers using the <send> and <cancel> tags (see blackjack example).
  • Conformance with the SCXML draft spec.

The SCXML enabler works very nicely with the QtScript Binding Generator, and an interesting demo is coming up soon...

We've been hearing from people that they've been able to utilize this (tiny) library to develop QA solutions, and to model car infotainment systems. We'd like to know if this library is useful for you, and how!

Blog Topics: