summaryrefslogtreecommitdiffstats
path: root/src/corelib/statemachine/qabstractstate.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/corelib/statemachine/qabstractstate.cpp')
-rw-r--r--src/corelib/statemachine/qabstractstate.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/corelib/statemachine/qabstractstate.cpp b/src/corelib/statemachine/qabstractstate.cpp
index 72d640b..cf67cdd 100644
--- a/src/corelib/statemachine/qabstractstate.cpp
+++ b/src/corelib/statemachine/qabstractstate.cpp
@@ -78,7 +78,8 @@ QT_BEGIN_NAMESPACE
function to perform custom processing when the state is exited.
*/
-QAbstractStatePrivate::QAbstractStatePrivate()
+QAbstractStatePrivate::QAbstractStatePrivate()
+ : parentState(0)
{
}
@@ -150,7 +151,10 @@ QAbstractState::~QAbstractState()
*/
QState *QAbstractState::parentState() const
{
- return qobject_cast<QState*>(parent());
+ Q_D(const QAbstractState);
+ if (d->parentState != parent())
+ d->parentState = qobject_cast<QState*>(parent());
+ return d->parentState;
}
/*!