Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Add transition state machine
lukigno last edited by
I implemented a three state machine and declared a function that change the current state of the machine: void changeState(s1); that contains the following command in order to change machine state:
because I don't have any sender and receiver.
When I compile it no error appears, but when I run the application the following message appears:
QObject::setParent: Cannot set parent, new parent is in a different thread
Shall I necessarily connect the transition to a signal? If yes how can I do it?
Thanks a lot for your help.
mcosta last edited by
The runtime error you show means that the new parent was created in a different thread than current one.
Related to your code, this means that s0 was created in a Thread and the addTransition call is done in a different one.
Could you post your code?