Hello. If I have for example three states s1, s2 and s3. How do I get the current state of the state machine.
while(stateMachine->activeState() == s2)
{
//do something
}
Thanks.
Hello. If I have for example three states s1, s2 and s3. How do I get the current state of the state machine.
while(stateMachine->activeState() == s2)
{
//do something
}
Thanks.
I never used QStateMachine, but the docs say that every state emits entered() signal, you could create slots for every signal and have a variable that stores the current signal. Or even connect them all to one slot and use QObject::sender().
QStateMachine::configuration() gives you the current states.
Qt Code:
while(stateMachine->configuration().contains(s2)) { //do something }To copy to clipboard, switch view to plain text mode
Bookmarks