[Qt-interest] Using QStateMachine in large apps (Was qscxml and Qhttp)

Sean Harmer sean.harmer at maps-technology.com
Fri Oct 22 10:16:31 CEST 2010


Hi,

On Friday 22 October 2010 02:16:49 Stephen Kelly wrote:
> Stephen Kelly wrote:
> > Sorry for the brain-dump post. I haven't written any code for this yet,
> > only read documentation so far. Hope I got it right.
> 
> Just implemented it with C++:
> 
> http://websvn.kde.org/trunk/KDE/kdepim/mobile/lib/statemachinebuilder.cpp?v
> iew=markup

We are making heavy use of the SM framework in a similar way (but mainly for 
hardware control in our case) and have found it to be really worth the effort 
to learn. It makes it so much easier to properly handle all of the annoying 
corner cases that seem to crop up when managing collections of state-like 
variables manually.

> Haven't checked if it works yet though :/ Still interested in the xml
> descriptions though.

I too would be interested in this. We eneded up with an inheritcance hierarchy 
of states in several cases and I could not see how to achieve this using the 
scxml approach.

> The state machine framework looks great by the way. Very useful looking,
> especially with model-view + QML.

What would make it really awesome to work with would be a SM editor plugin for 
creator where you can draw out your state chart and promote the states and 
transitions to objects of custom classes liek you can do with widgets in 
designer/creator. 

This approach would be better as I do not think that any fully automated code 
generation scheme will be able to capture all of the details that may be 
needed in some of the complex eventTest(), onTransition(), onEntry() and 
onExit() functions of custom states and transitions (or the payloads of custom 
events for that matter).

Taking this even further, another really useful feature would be a graphical 
state machine debugger component where you can monitor/break on transitions 
etc. See

http://bugreports.qt.nokia.com/browse/QTBUG-9380

Good luck with your SM adventures.

Sean



More information about the Qt-interest-old mailing list