diff options
author | Kent Hansen <khansen@trolltech.com> | 2009-04-22 17:20:19 +0200 |
---|---|---|
committer | Kent Hansen <khansen@trolltech.com> | 2009-04-22 17:20:19 +0200 |
commit | f87641584424deed25e2abdadea08c3be94b9ce1 (patch) | |
tree | a185687744e724a8db896970416f23d20f5cad38 /src/corelib/statemachine/qabstractstate.cpp | |
parent | 31f5348ea1691a7664b6abc04cf425dd02637b33 (diff) |
kill the stateactions api
It just didn't give us that much.
Typically you just reimplement onEntry/onExit/onTransition
when you want to do something.
We go back to the signals-and-slots approach: states have
entered() and exited() signals that you can connect to.
It's still possible to have an action-based API, but then
you build it on top of the core API, which is OK.
Replacing 4 public classes (and one layer in the hierarchy)
with 2 signals feels good.
Diffstat (limited to 'src/corelib/statemachine/qabstractstate.cpp')
-rw-r--r-- | src/corelib/statemachine/qabstractstate.cpp | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/corelib/statemachine/qabstractstate.cpp b/src/corelib/statemachine/qabstractstate.cpp index 89dcff99a8..030c63c6e4 100644 --- a/src/corelib/statemachine/qabstractstate.cpp +++ b/src/corelib/statemachine/qabstractstate.cpp @@ -62,6 +62,9 @@ QT_BEGIN_NAMESPACE The assignProperty() function is used for defining property assignments that should be performed when a state is entered. + The entered() signal is emitted when the state has been entered. The + exited() signal is emitted when the state has been exited. + The parentState() function returns the state's parent state. \section1 Subclassing @@ -149,6 +152,18 @@ void QAbstractStatePrivate::callOnExit() q->onExit(); } +void QAbstractStatePrivate::emitEntered() +{ + Q_Q(QAbstractState); + emit q->entered(); +} + +void QAbstractStatePrivate::emitExited() +{ + Q_Q(QAbstractState); + emit q->exited(); +} + /*! Constructs a new state with the given \a parent state. */ @@ -256,6 +271,20 @@ QAbstractState::RestorePolicy QAbstractState::restorePolicy() const */ /*! + \fn QAbstractState::entered() + + This signal is emitted when the state has been entered (after onEntry() has + been called). +*/ + +/*! + \fn QAbstractState::exited() + + This signal is emitted when the state has been exited (after onExit() has + been called). +*/ + +/*! \reimp */ bool QAbstractState::event(QEvent *e) |