diff options
author | Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com> | 2009-11-03 12:13:35 (GMT) |
---|---|---|
committer | Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com> | 2009-11-03 15:23:03 (GMT) |
commit | 569e4b636fc91a9d5c6f6e4d65967327786adb3c (patch) | |
tree | 2a154aea887bdf286784cc66db14193d48103d54 /src/corelib | |
parent | b210026bda1fcd6d38b8a5a556aefe4fb5c4f891 (diff) | |
download | Qt-569e4b636fc91a9d5c6f6e4d65967327786adb3c.zip Qt-569e4b636fc91a9d5c6f6e4d65967327786adb3c.tar.gz Qt-569e4b636fc91a9d5c6f6e4d65967327786adb3c.tar.bz2 |
Remove return type of QState::addTransition(QAbstractTransition*)
Returning the input argument in a function can lead to confusion and
serves no purpose here. Instead, we'll mirror the API from
QMenu::addAction() overloads, where the overload that takes a
preconstructed object has a void return type.
Reviewed-by: Kent Hansen
Diffstat (limited to 'src/corelib')
-rw-r--r-- | src/corelib/statemachine/qstate.cpp | 15 | ||||
-rw-r--r-- | src/corelib/statemachine/qstate.h | 2 |
2 files changed, 8 insertions, 9 deletions
diff --git a/src/corelib/statemachine/qstate.cpp b/src/corelib/statemachine/qstate.cpp index bcd8364..ea20619 100644 --- a/src/corelib/statemachine/qstate.cpp +++ b/src/corelib/statemachine/qstate.cpp @@ -286,15 +286,14 @@ void QState::setErrorState(QAbstractState *state) /*! Adds the given \a transition. The transition has this state as the source. - This state takes ownership of the transition. If the transition is successfully - added, the function will return the \a transition pointer. Otherwise it will return null. + This state takes ownership of the transition. */ -QAbstractTransition *QState::addTransition(QAbstractTransition *transition) +void QState::addTransition(QAbstractTransition *transition) { Q_D(QState); if (!transition) { qWarning("QState::addTransition: cannot add null transition"); - return 0; + return ; } transition->setParent(this); @@ -303,18 +302,17 @@ QAbstractTransition *QState::addTransition(QAbstractTransition *transition) QAbstractState *t = targets.at(i).data(); if (!t) { qWarning("QState::addTransition: cannot add transition to null state"); - return 0; + return ; } if ((QAbstractStatePrivate::get(t)->machine() != d->machine()) && QAbstractStatePrivate::get(t)->machine() && d->machine()) { qWarning("QState::addTransition: cannot add transition " "to a state in a different state machine"); - return 0; + return ; } } if (machine() != 0 && machine()->configuration().contains(this)) QStateMachinePrivate::get(machine())->registerTransitions(this); - return transition; } /*! @@ -379,7 +377,8 @@ QAbstractTransition *QState::addTransition(QAbstractState *target) return 0; } UnconditionalTransition *trans = new UnconditionalTransition(target); - return addTransition(trans); + addTransition(trans); + return trans; } /*! diff --git a/src/corelib/statemachine/qstate.h b/src/corelib/statemachine/qstate.h index 7a47447..781382d 100644 --- a/src/corelib/statemachine/qstate.h +++ b/src/corelib/statemachine/qstate.h @@ -76,7 +76,7 @@ public: QAbstractState *errorState() const; void setErrorState(QAbstractState *state); - QAbstractTransition *addTransition(QAbstractTransition *transition); + void addTransition(QAbstractTransition *transition); QSignalTransition *addTransition(QObject *sender, const char *signal, QAbstractState *target); QAbstractTransition *addTransition(QAbstractState *target); void removeTransition(QAbstractTransition *transition); |