Question

I added my state to m. This code will delete mystate?

QStateMachine *m = new QStateMachine(); 
QState *mystate = new QState();
m->addState(mystate);
delete m;
Was it helpful?

Solution

It is the same as with layouts.
The state machine will take ownership if you add the state and releases ownership when you manually remove the state from the state machine.

void QStateMachine::removeState ( QAbstractState * state )
Removes the given state from this state machine. The state machine releases ownership of the state.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top