diff options
author | Kent Hansen <khansen@trolltech.com> | 2009-04-27 16:07:03 (GMT) |
---|---|---|
committer | Kent Hansen <khansen@trolltech.com> | 2009-04-27 16:07:03 (GMT) |
commit | a460bee2b3051bf6a5176b5c620f81ff962a7f53 (patch) | |
tree | cd16498e44c7ab61b527e4c192969d8101ccb5ad /src/corelib/statemachine/qstate.cpp | |
parent | 53e8c64d0ed050bc195bb4851da2f6d65b5c8ca5 (diff) | |
download | Qt-a460bee2b3051bf6a5176b5c620f81ff962a7f53.zip Qt-a460bee2b3051bf6a5176b5c620f81ff962a7f53.tar.gz Qt-a460bee2b3051bf6a5176b5c620f81ff962a7f53.tar.bz2 |
replace QStateFinished{Event,Transition} by QState::finished() signal
Not worth it having two public classes when the same can be achieved
by having a signal.
Diffstat (limited to 'src/corelib/statemachine/qstate.cpp')
-rw-r--r-- | src/corelib/statemachine/qstate.cpp | 30 |
1 files changed, 12 insertions, 18 deletions
diff --git a/src/corelib/statemachine/qstate.cpp b/src/corelib/statemachine/qstate.cpp index 56a855e..9bda250 100644 --- a/src/corelib/statemachine/qstate.cpp +++ b/src/corelib/statemachine/qstate.cpp @@ -46,7 +46,6 @@ #include "qabstracttransition.h" #include "qabstracttransition_p.h" #include "qsignaltransition.h" -#include "qstatefinishedtransition.h" #include "qstatemachine.h" #include "qstatemachine_p.h" @@ -75,9 +74,6 @@ QT_BEGIN_NAMESPACE The addHistoryState() function adds a history state. - The addFinishedTransition() function creates and adds a transition that's - triggered when a final child state is entered. - The setErrorState() sets the state's error state. The error state is the state that the state machine will transition to if an error is detected when attempting to enter the state (e.g. because no initial state has been set). @@ -134,6 +130,12 @@ const QStatePrivate *QStatePrivate::get(const QState *q) return q->d_func(); } +void QStatePrivate::emitFinished() +{ + Q_Q(QState); + emit q->finished(); +} + /*! Constructs a new state with the given \a parent state. */ @@ -294,20 +296,6 @@ QSignalTransition *QState::addTransition(QObject *sender, const char *signal, return trans; } -/*! - Adds a transition that's triggered by the finished event of this state, and - returns the new QStateFinishedTransition object. The transition has the - given \a target state. - - \sa QStateFinishedEvent -*/ -QStateFinishedTransition *QState::addFinishedTransition(QAbstractState *target) -{ - QStateFinishedTransition *trans = new QStateFinishedTransition(this, QList<QAbstractState*>() << target); - addTransition(trans); - return trans; -} - namespace { // ### Make public? @@ -431,4 +419,10 @@ bool QState::event(QEvent *e) return QAbstractState::event(e); } +/*! + \fn QState::finished() + + This signal is emitted when a final child state of this state is entered. +*/ + QT_END_NAMESPACE |