Hi,
I have a QStateMachine and I need to go directly at one QState without SIGNAL.
I need a function like GoToState(QAbstractState*).
Suggestions?
Thanks
Teo
Printable View
Hi,
I have a QStateMachine and I need to go directly at one QState without SIGNAL.
I need a function like GoToState(QAbstractState*).
Suggestions?
Thanks
Teo
Its pretty clear from the documentation that you can't (unfortunately? not sure), unless you extend QState yourself. Cant see why you would need to, except for convenience sake (agreed? not sure either :)). The way suggested is to put all states in a parent state and define a transition on the parent, then post an Event/Signal to the machine:
Code:
QStateMachine * m = new QStateMachine(); QState * operational = new QState(m); QState * error = new QState(m); QState * init = new QState(operational); QState * a = new QState(operational); QState * b = new QState(operational); QState * c = new QState(operational); //... more states ... m->setInitialState(operational); operational->setInitialState(init); operational->addTransition(this,SIGNAL(error()),error); error->addTranistion(this,SIGNAL(fixedError()),operational); //... more transitions ...