C++ Qt: Check the current State of QStateMachine

tbienias picture tbienias · Dec 15, 2011 · Viewed 9.7k times · Source

I'm trying to implement a state-machine in Qt (C++). How can I check the current state of the QStateMachine? I couldn't find a method in the documentation.

thx

Answer

Hemant Metalia picture Hemant Metalia · Dec 15, 2011

have you tried QStateMachine::configuration() ?

refer http://www.qtcentre.org/threads/42085-How-to-get-the-current-state-of-QStateMachine

Excerpt from the above url:

// QStateMachine::configuration() gives you the current states.

while(stateMachine->configuration().contains(s2))
{
     //do something
}