summaryrefslogtreecommitdiffstats
path: root/examples/animation/stickman/lifecycle.cpp
diff options
context:
space:
mode:
authorKent Hansen <khansen@trolltech.com>2009-04-22 15:20:19 (GMT)
committerKent Hansen <khansen@trolltech.com>2009-04-22 15:20:19 (GMT)
commitf87641584424deed25e2abdadea08c3be94b9ce1 (patch)
treea185687744e724a8db896970416f23d20f5cad38 /examples/animation/stickman/lifecycle.cpp
parent31f5348ea1691a7664b6abc04cf425dd02637b33 (diff)
downloadQt-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/animation/stickman/lifecycle.cpp')
-rw-r--r--examples/animation/stickman/lifecycle.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/examples/animation/stickman/lifecycle.cpp b/examples/animation/stickman/lifecycle.cpp
index 9233760..e67b32d 100644
--- a/examples/animation/stickman/lifecycle.cpp
+++ b/examples/animation/stickman/lifecycle.cpp
@@ -86,8 +86,8 @@ LifeCycle::LifeCycle(StickMan *stickMan, GraphicsView *keyReceiver)
QTimer *timer = new QTimer(lightningBlink);
timer->setSingleShot(true);
timer->setInterval(100);
- lightningBlink->invokeMethodOnEntry(timer, "start");
- lightningBlink->invokeMethodOnExit(timer, "stop");
+ QObject::connect(lightningBlink, SIGNAL(entered()), timer, SLOT(start()));
+ QObject::connect(lightningBlink, SIGNAL(exited()), timer, SLOT(stop()));
m_dead = new QState(m_machine->rootState());
m_dead->setRestorePolicy(QState::DoNotRestoreProperties);