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 /examples/statemachine/composition | |
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 'examples/statemachine/composition')
-rw-r--r-- | examples/statemachine/composition/main.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/examples/statemachine/composition/main.cpp b/examples/statemachine/composition/main.cpp index 24b823c..927fc62 100644 --- a/examples/statemachine/composition/main.cpp +++ b/examples/statemachine/composition/main.cpp @@ -63,7 +63,7 @@ int main(int argc, char **argv) s1_timer->setObjectName("s1_timer"); QTimer t1; t1.setInterval(2000); - s1_timer->invokeMethodOnEntry(&t1, "start"); + QObject::connect(s1_timer, SIGNAL(entered()), &t1, SLOT(start())); QFinalState *s1_done = new QFinalState(s1); s1_done->setObjectName("s1_done"); s1_timer->addTransition(&t1, SIGNAL(timeout()), s1_done); @@ -80,7 +80,7 @@ int main(int argc, char **argv) s2_timer->setObjectName("s2_timer"); QTimer t2; t2.setInterval(2000); - s2_timer->invokeMethodOnEntry(&t2, "start"); + QObject::connect(s2_timer, SIGNAL(entered()), &t2, SLOT(start())); QFinalState *s2_done = new QFinalState(s2); s2_done->setObjectName("s2_done"); s2_timer->addTransition(&t2, SIGNAL(timeout()), s2_done); |