[Qt-interest] QStateMachine and setting states directly

Sean Harmer sean.harmer at maps-technology.com
Wed Dec 30 16:12:17 CET 2009


Hi,

Wilhelm wrote:
> Hello,
> 
> I'm using the new QStateMachine framework together with the 
> QUndoCommand. If I undo a command in the application I need to go back 
> to the previous state. This is not the last sub-state when leaving a 
> parent-state, this can be done with QHistoryState.
> 
> So what I'm looking for is the possibility to set a state directly. Is 
> there any direct way?

Whilst looking at the QStateMachine internals I just stumbled across the 
  function QStateMachine::goToState(QAbstractState *targetState) whcih 
does what you need although it bypasses the whol epoint of a state machine.

HTH,

Sean




More information about the Qt-interest-old mailing list