diff options
author | Leonardo Sobral Cunha <leo.cunha@nokia.com> | 2009-09-25 11:15:24 (GMT) |
---|---|---|
committer | Leonardo Sobral Cunha <leo.cunha@nokia.com> | 2009-09-25 11:16:11 (GMT) |
commit | 8a993264ca8bd6273f1d5bb4288d64592d07760f (patch) | |
tree | 2839ded5ae946485e6db94d45dd9ddf6461dfc53 | |
parent | 0fa201d84468d82bec4268971eba865c50606e5c (diff) | |
download | Qt-8a993264ca8bd6273f1d5bb4288d64592d07760f.zip Qt-8a993264ca8bd6273f1d5bb4288d64592d07760f.tar.gz Qt-8a993264ca8bd6273f1d5bb4288d64592d07760f.tar.bz2 |
Replacing QPointer usage with QWeakPointer in statemachine
Reviewed-by: thierry
-rw-r--r-- | src/corelib/statemachine/qabstracttransition.cpp | 6 | ||||
-rw-r--r-- | src/corelib/statemachine/qabstracttransition_p.h | 4 | ||||
-rw-r--r-- | 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<QAbstractState*> QAbstractTransition::targetStates() const Q_D(const QAbstractTransition); QList<QAbstractState*> 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<QAbstractState*> &targets) { Q_D(QAbstractTransition); - for (int i=0; i<targets.size(); ++i) { + for (int i = 0; i < targets.size(); ++i) { QAbstractState *target = targets.at(i); if (!target) { qWarning("QAbstractTransition::setTargetStates: target state(s) cannot be null"); diff --git a/src/corelib/statemachine/qabstracttransition_p.h b/src/corelib/statemachine/qabstracttransition_p.h index 7465243..5b4df1b 100644 --- a/src/corelib/statemachine/qabstracttransition_p.h +++ b/src/corelib/statemachine/qabstracttransition_p.h @@ -56,7 +56,7 @@ #include <private/qobject_p.h> #include <QtCore/qlist.h> -#include <QtCore/qpointer.h> +#include <QtCore/qsharedpointer.h> QT_BEGIN_NAMESPACE @@ -80,7 +80,7 @@ public: QStateMachine *machine() const; void emitTriggered(); - QList<QPointer<QAbstractState> > targetStates; + QList<QWeakPointer<QAbstractState> > targetStates; #ifndef QT_NO_ANIMATION QList<QAbstractAnimation*> 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<QPointer<QAbstractState> > &targets = QAbstractTransitionPrivate::get(transition)->targetStates; + const QList<QWeakPointer<QAbstractState> > &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; |