[Qt-interest] Qt State machine framework

Mandeep Sandhu mandeepsandhu.chd at gmail.com
Fri Mar 12 06:19:52 CET 2010


Hi All,

I'm planning to implement a FSM for one of my apps using the Qt State
machine framework. I have some requirements which somehow are not
there in this frame work by default (maybe I'm missing something).
They are:

* I need to emit a signal whenever the FSM transitions from 1 state to
another. The signal emits the old state and the new state
* I need to provide an API to a caller to let it know what the current
state the FSM is in.

For the 1st requirement I could not find an existing API's which can
do that (only started, stopped, finished signals are emitted by the
qtstatemachine class).

I can think of many ways to do it, eg: create my own transition and
emit a signal in it's onTransition() method, create my own state
(subclassing the QtAbstractState and emit a signal in it's onEntry
method...though I won't have the previous state then...)

For the second part I need to keep updating some member of my class to
keep track of the current state (lame).

Any suggestions on better approaches (if any)?

Thanks,
-mandeep



More information about the Qt-interest-old mailing list