Search code examples
c++qtqstatemachine

C++ Qt: Check the current State of QStateMachine


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


Solution

  • 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
    }