diff options
author | Kent Hansen <khansen@trolltech.com> | 2009-05-05 16:17:43 (GMT) |
---|---|---|
committer | Kent Hansen <khansen@trolltech.com> | 2009-05-05 16:17:43 (GMT) |
commit | 2e0430832d3656753f73b09765769d10aa51add3 (patch) | |
tree | 04c9fa068c57b90de15ebd01831a0e140b2b8e6c /src/corelib/statemachine/qabstractstate.cpp | |
parent | 6eae8aedd14acbc4ea73f336124b0243e9ebb9c0 (diff) | |
download | Qt-2e0430832d3656753f73b09765769d10aa51add3.zip Qt-2e0430832d3656753f73b09765769d10aa51add3.tar.gz Qt-2e0430832d3656753f73b09765769d10aa51add3.tar.bz2 |
add event as argument to onEntry(), onExit() and onTransition()
Accessing the event can be useful. E.g., onEntry() can do some
common event processing regardless of which transition caused the
state to be entered; onTransition() can be used in combination
with eventTest(), where eventTest() would first check that the
input matches some criteria, and then the actual processing of that
input would be done in onTransition.
Diffstat (limited to 'src/corelib/statemachine/qabstractstate.cpp')
-rw-r--r-- | src/corelib/statemachine/qabstractstate.cpp | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/src/corelib/statemachine/qabstractstate.cpp b/src/corelib/statemachine/qabstractstate.cpp index cc6f0f9..3f84314 100644 --- a/src/corelib/statemachine/qabstractstate.cpp +++ b/src/corelib/statemachine/qabstractstate.cpp @@ -101,16 +101,16 @@ QStateMachine *QAbstractStatePrivate::machine() const return 0; } -void QAbstractStatePrivate::callOnEntry() +void QAbstractStatePrivate::callOnEntry(QEvent *e) { Q_Q(QAbstractState); - q->onEntry(); + q->onEntry(e); } -void QAbstractStatePrivate::callOnExit() +void QAbstractStatePrivate::callOnExit(QEvent *e) { Q_Q(QAbstractState); - q->onExit(); + q->onExit(e); } void QAbstractStatePrivate::emitEntered() @@ -190,17 +190,19 @@ QStateMachine *QAbstractState::machine() const } /*! - \fn QAbstractState::onExit() + \fn QAbstractState::onExit(QEvent *event) - This function is called when the state is exited. Reimplement this function - to perform custom processing when the state is exited. + This function is called when the state is exited. The given \a event is what + caused the state to be exited. Reimplement this function to perform custom + processing when the state is exited. */ /*! - \fn QAbstractState::onEntry() + \fn QAbstractState::onEntry(QEvent *event) - This function is called when the state is entered. Reimplement this function - to perform custom processing when the state is entered. + This function is called when the state is entered. The given \a event is + what caused the state to be entered. Reimplement this function to perform + custom processing when the state is entered. */ /*! |