diff options
author | Kent Hansen <khansen@trolltech.com> | 2009-04-22 15:20:19 (GMT) |
---|---|---|
committer | Kent Hansen <khansen@trolltech.com> | 2009-04-22 15:20:19 (GMT) |
commit | f87641584424deed25e2abdadea08c3be94b9ce1 (patch) | |
tree | a185687744e724a8db896970416f23d20f5cad38 /doc/src/statemachine.qdoc | |
parent | 31f5348ea1691a7664b6abc04cf425dd02637b33 (diff) | |
download | Qt-f87641584424deed25e2abdadea08c3be94b9ce1.zip Qt-f87641584424deed25e2abdadea08c3be94b9ce1.tar.gz Qt-f87641584424deed25e2abdadea08c3be94b9ce1.tar.bz2 |
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 'doc/src/statemachine.qdoc')
-rw-r--r-- | doc/src/statemachine.qdoc | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/doc/src/statemachine.qdoc b/doc/src/statemachine.qdoc index 3051d19..97c09b9 100644 --- a/doc/src/statemachine.qdoc +++ b/doc/src/statemachine.qdoc @@ -91,13 +91,12 @@ When any of the states is entered, the label's text will be changed accordingly. - The QActionState::invokeMethodOnEntry() function can be used to have a state - invoke a method (a slot) of a QObject when the state is entered. In the + The QActionState::entered() signal is emitted when the state is entered. In the following snippet, the button's showMaximized() slot will be called when state \c s3 is entered: \code - s2->invokeMethodOnEntry(button, "showMaximized"); + QObject::connect(s3, SIGNAL(entered()), button, SLOT(showMaximized())); \endcode \section1 Sharing Transitions By Grouping States @@ -209,7 +208,7 @@ mbox.addButton(QMessageBox::Ok); mbox.setText("Interrupted!"); mbox.setIcon(QMessageBox::Information); - s3->invokeMethodOnEntry(&mbox, "exec"); + QObject::connect(s3, SIGNAL(entered()), &mbox, SLOT(exec())); s3->addTransition(s1h); machine.addState(s3); |