views:

77

answers:

1

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

QStateMachine *m = new QStateMachine(); 
QState *mystate = new QState();
m->addState(mystate);
delete m;
+1  A: 

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.

TimW