[Qt-interest] Qt State machine framework

Kent Hansen khansen at trolltech.com
Thu Mar 25 11:08:31 CET 2010


Hi,

Mandeep Sandhu wrote:
> I think it'll be helpful for the app developer to know where the SM
> transitioned from, especially since we can can land up in the same
> state from 2 different source states (obviously on 2 diff events at
> different times). Some of these events are generated internally (from
> an app's point of view). Just knowing the current state might not
> suffice. OR it might, if we assume that it's the apps responsibility
> to keep track of state transitions (I just tell it whenever a new
> transition happens and the new state).
>   

Would it help if QStateMachine had a configurationChanged() signal? That 
way you would have a central place to monitor state changes, and could 
record the configuration at each step if desired (a "trace" of the 
machine execution).

> Also, I believe that concepts like history states/ state groups etc
> are internal to the SM (since it's used only as a way to express the
> SM). From the outside, even if I transition to state group (using
> history or default state) I still should be able to find out what
> child state I'm in, since that really represents the true state. The
> caller is totally ignorant of the state group concept.
>   

Well, QStateMachine::configuration() gives you a flat set of states. 
 From that you can determine which members of the set are the inner-most 
(child) states.

Kent



More information about the Qt-interest-old mailing list