diff -r 56cd8111b7f7 -r 41300fa6a67c src/corelib/statemachine/qabstractstate.cpp --- a/src/corelib/statemachine/qabstractstate.cpp Tue Jan 26 12:42:25 2010 +0200 +++ b/src/corelib/statemachine/qabstractstate.cpp Tue Feb 02 00:43:10 2010 +0200 @@ -78,7 +78,8 @@ function to perform custom processing when the state is exited. */ -QAbstractStatePrivate::QAbstractStatePrivate() +QAbstractStatePrivate::QAbstractStatePrivate(StateType type) + : stateType(type), isMachine(false), parentState(0) { } @@ -87,6 +88,11 @@ return q->d_func(); } +const QAbstractStatePrivate *QAbstractStatePrivate::get(const QAbstractState *q) +{ + return q->d_func(); +} + QStateMachine *QAbstractStatePrivate::machine() const { QObject *par = parent; @@ -126,7 +132,7 @@ Constructs a new state with the given \a parent state. */ QAbstractState::QAbstractState(QState *parent) - : QObject(*new QAbstractStatePrivate, parent) + : QObject(*new QAbstractStatePrivate(QAbstractStatePrivate::AbstractState), parent) { } @@ -150,7 +156,10 @@ */ QState *QAbstractState::parentState() const { - return qobject_cast(parent()); + Q_D(const QAbstractState); + if (d->parentState != parent()) + d->parentState = qobject_cast(parent()); + return d->parentState; } /*!