From 8a993264ca8bd6273f1d5bb4288d64592d07760f Mon Sep 17 00:00:00 2001 From: Leonardo Sobral Cunha Date: Fri, 25 Sep 2009 13:15:24 +0200 Subject: Replacing QPointer usage with QWeakPointer in statemachine Reviewed-by: thierry --- src/corelib/statemachine/qabstracttransition.cpp | 6 +++--- src/corelib/statemachine/qabstracttransition_p.h | 4 ++-- src/corelib/statemachine/qstate.cpp | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/corelib/statemachine/qabstracttransition.cpp b/src/corelib/statemachine/qabstracttransition.cpp index a81fe0f..8b858c7 100644 --- a/src/corelib/statemachine/qabstracttransition.cpp +++ b/src/corelib/statemachine/qabstracttransition.cpp @@ -187,7 +187,7 @@ QAbstractState *QAbstractTransition::targetState() const Q_D(const QAbstractTransition); if (d->targetStates.isEmpty()) return 0; - return d->targetStates.first(); + return d->targetStates.first().data(); } /*! @@ -211,7 +211,7 @@ QList QAbstractTransition::targetStates() const Q_D(const QAbstractTransition); QList result; for (int i = 0; i < d->targetStates.size(); ++i) { - QAbstractState *target = d->targetStates.at(i); + QAbstractState *target = d->targetStates.at(i).data(); if (target) result.append(target); } @@ -225,7 +225,7 @@ void QAbstractTransition::setTargetStates(const QList &targets) { Q_D(QAbstractTransition); - for (int i=0; i #include -#include +#include QT_BEGIN_NAMESPACE @@ -80,7 +80,7 @@ public: QStateMachine *machine() const; void emitTriggered(); - QList > targetStates; + QList > targetStates; #ifndef QT_NO_ANIMATION QList animations; diff --git a/src/corelib/statemachine/qstate.cpp b/src/corelib/statemachine/qstate.cpp index 70026b8..a6e4a57 100644 --- a/src/corelib/statemachine/qstate.cpp +++ b/src/corelib/statemachine/qstate.cpp @@ -291,9 +291,9 @@ QAbstractTransition *QState::addTransition(QAbstractTransition *transition) } transition->setParent(this); - const QList > &targets = QAbstractTransitionPrivate::get(transition)->targetStates; + const QList > &targets = QAbstractTransitionPrivate::get(transition)->targetStates; for (int i = 0; i < targets.size(); ++i) { - QAbstractState *t = targets.at(i); + QAbstractState *t = targets.at(i).data(); if (!t) { qWarning("QState::addTransition: cannot add transition to null state"); return 0; -- cgit v0.12