[Qt-interest] Debugging Qt StateMachine

Stephen Kelly steveire at gmail.com
Tue Sep 13 17:44:33 CEST 2011


Mandeep Sandhu wrote:

>> So far, I haven't found anything helpful in the state machine framework.
>> Of course, I could connect to the entered() signals of all states, but I
>> haven't figured out a way I could determine which state sent me the
>> signal.
> 
> You can extend the QState (or QAbstractState) class to implement the
> onEntry()/onExit to log whenever  that state is entered/exited.
> 
> Similarly, you could put logs in your transitions onTransition()
> callback to log whenever that transition is triggered by the SM.
> 
> HTH,
> -mandeep

There is also the undocumented beginMicroStep and endMicroStep virtual 
methods on QStateMachine. Overriding those may be preferrable compared to 
subclassing QState QFinalState and QHistoryState.

I agree that QStateMachine should issue signals when changing its 
configuration, but it doesn't.




More information about the Qt-interest-old mailing list