I understand that I am coming late, but I hope this answer helps someone else who stumbles about it.
You mentioned above that you already tried to use configuration (), but none of your states were there - this is because start () is asynchronous.
So, assuming that you called configuration () right after calling start (), it makes sense that your states have not existed yet. You can get the necessary functionality using the initial () signal of the QStateMachine class. Check this:
stateMachine->setInitialState(someState); stateMachine->start(); connect(stateMachine, SIGNAL(started()), this, SLOT(ReceiveStateMachineStarted()));
Then for your ReceiveStateMachineStarted () slot, you can do something like this:
void MyClass::ReceiveStateMachineStarted() { QSet<QAbstractState*> stateSet = stateMachine->configuration(); qDebug() << stateSet; }
When your state machine goes back to its original state, it issues a start () signal. The slot you wrote will hear this and print the configuration. See the following Qt documentation for more on this:
http://doc.qt.io/qt-5/qstatemachine.html#started
Sam f
source share