我正在尝试在 Qt (C++) 中实现一个状态机。
如何检查 QStateMachine 的当前状态?
我在文档中找不到方法。

谢谢

最佳答案

你试过 QStateMachine::configuration() 吗?

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

以上网址摘录:

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

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

关于C++ Qt : Check the current State of QStateMachine,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/8519890/

10-13 08:33