[Qt-interest] Setting State in QStateMachine

noam.rosenthal at nokia.com noam.rosenthal at nokia.com
Tue Jun 21 22:25:56 CEST 2011


From: qt-interest-bounces+noam.rosenthal=nokia.com at qt.nokia.com [qt-interest-bounces+noam.rosenthal=nokia.com at qt.nokia.com] On Behalf Of ext NoRulez [norulez at me.com]
> I've a simple statemachine with 4 states. After clicking a button the states will change.
> Now the problem I have is if I get a signal I want to change the state to e.g. 2
> I use addTransition for the entered() signal, but the state isn't entered.
> Could anybody give me a hint on how to switch states?

You should add a transition to the origin state, that binds to the signal.
E.g.
state1->addTransition(myButton, SIGNAL(clicked()), state2);

If you're doing this and something doesn't work, please clarify your question with maybe a bit of example code :)

No'am



More information about the Qt-interest-old mailing list