diff --git a/src/corelib/statemachine/qsignaltransition.cpp b/src/corelib/statemachine/qsignaltransition.cpp index d64a91a435..73b6aa1ef9 100644 --- a/src/corelib/statemachine/qsignaltransition.cpp +++ b/src/corelib/statemachine/qsignaltransition.cpp @@ -148,7 +148,7 @@ QSignalTransition::QSignalTransition(QState *sourceState) Constructs a new signal transition associated with the given \a signal of the given \a sender, and with the given \a sourceState. */ -QSignalTransition::QSignalTransition(QObject *sender, const char *signal, +QSignalTransition::QSignalTransition(const QObject *sender, const char *signal, QState *sourceState) : QAbstractTransition(*new QSignalTransitionPrivate, sourceState) { @@ -171,13 +171,13 @@ QSignalTransition::~QSignalTransition() QObject *QSignalTransition::senderObject() const { Q_D(const QSignalTransition); - return d->sender; + return const_cast(d->sender); } /*! Sets the \a sender object associated with this signal transition. */ -void QSignalTransition::setSenderObject(QObject *sender) +void QSignalTransition::setSenderObject(const QObject *sender) { Q_D(QSignalTransition); if (sender == d->sender) diff --git a/src/corelib/statemachine/qsignaltransition.h b/src/corelib/statemachine/qsignaltransition.h index 6804fe140f..81bf6e279c 100644 --- a/src/corelib/statemachine/qsignaltransition.h +++ b/src/corelib/statemachine/qsignaltransition.h @@ -59,12 +59,12 @@ class Q_CORE_EXPORT QSignalTransition : public QAbstractTransition Q_PROPERTY(QByteArray signal READ signal WRITE setSignal) public: QSignalTransition(QState *sourceState = 0); - QSignalTransition(QObject *sender, const char *signal, + QSignalTransition(const QObject *sender, const char *signal, QState *sourceState = 0); ~QSignalTransition(); QObject *senderObject() const; - void setSenderObject(QObject *sender); + void setSenderObject(const QObject *sender); QByteArray signal() const; void setSignal(const QByteArray &signal); diff --git a/src/corelib/statemachine/qsignaltransition_p.h b/src/corelib/statemachine/qsignaltransition_p.h index 1e272259ce..dc6b76489f 100644 --- a/src/corelib/statemachine/qsignaltransition_p.h +++ b/src/corelib/statemachine/qsignaltransition_p.h @@ -71,7 +71,7 @@ public: virtual void callOnTransition(QEvent *e); - QObject *sender; + const QObject *sender; QByteArray signal; int signalIndex; int originalSignalIndex; diff --git a/src/corelib/statemachine/qstate.cpp b/src/corelib/statemachine/qstate.cpp index 126fa3adf7..7d4081f2c3 100644 --- a/src/corelib/statemachine/qstate.cpp +++ b/src/corelib/statemachine/qstate.cpp @@ -348,7 +348,7 @@ void QState::addTransition(QAbstractTransition *transition) object, and returns the new QSignalTransition object. The transition has this state as the source, and the given \a target as the target state. */ -QSignalTransition *QState::addTransition(QObject *sender, const char *signal, +QSignalTransition *QState::addTransition(const QObject *sender, const char *signal, QAbstractState *target) { if (!sender) { diff --git a/src/corelib/statemachine/qstate.h b/src/corelib/statemachine/qstate.h index 13335e80d7..8d20a67350 100644 --- a/src/corelib/statemachine/qstate.h +++ b/src/corelib/statemachine/qstate.h @@ -83,7 +83,7 @@ public: void setErrorState(QAbstractState *state); void addTransition(QAbstractTransition *transition); - QSignalTransition *addTransition(QObject *sender, const char *signal, QAbstractState *target); + QSignalTransition *addTransition(const QObject *sender, const char *signal, QAbstractState *target); QAbstractTransition *addTransition(QAbstractState *target); void removeTransition(QAbstractTransition *transition); QList transitions() const; diff --git a/src/corelib/statemachine/qstatemachine.cpp b/src/corelib/statemachine/qstatemachine.cpp index 8f105f9997..4d911cb4a2 100644 --- a/src/corelib/statemachine/qstatemachine.cpp +++ b/src/corelib/statemachine/qstatemachine.cpp @@ -1739,7 +1739,7 @@ void QStateMachinePrivate::registerSignalTransition(QSignalTransition *transitio Q_Q(QStateMachine); if (QSignalTransitionPrivate::get(transition)->signalIndex != -1) return; // already registered - QObject *sender = QSignalTransitionPrivate::get(transition)->sender; + const QObject *sender = QSignalTransitionPrivate::get(transition)->sender; if (!sender) return; QByteArray signal = QSignalTransitionPrivate::get(transition)->signal;