summaryrefslogtreecommitdiffstats
path: root/examples/statemachine/pingpong
diff options
context:
space:
mode:
authorKent Hansen <khansen@trolltech.com>2009-05-05 16:17:43 (GMT)
committerKent Hansen <khansen@trolltech.com>2009-05-05 16:17:43 (GMT)
commit2e0430832d3656753f73b09765769d10aa51add3 (patch)
tree04c9fa068c57b90de15ebd01831a0e140b2b8e6c /examples/statemachine/pingpong
parent6eae8aedd14acbc4ea73f336124b0243e9ebb9c0 (diff)
downloadQt-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 'examples/statemachine/pingpong')
-rw-r--r--examples/statemachine/pingpong/main.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/examples/statemachine/pingpong/main.cpp b/examples/statemachine/pingpong/main.cpp
index 68f7115..eb8fd5d 100644
--- a/examples/statemachine/pingpong/main.cpp
+++ b/examples/statemachine/pingpong/main.cpp
@@ -68,7 +68,7 @@ public:
: QState(parent) {}
protected:
- virtual void onEntry()
+ virtual void onEntry(QEvent *)
{
machine()->postEvent(new PingEvent());
fprintf(stdout, "ping?\n");
@@ -84,7 +84,7 @@ protected:
virtual bool eventTest(QEvent *e) const {
return (e->type() == QEvent::User+3);
}
- virtual void onTransition()
+ virtual void onTransition(QEvent *)
{
machine()->postEvent(new PingEvent(), 500);
fprintf(stdout, "ping?\n");
@@ -100,7 +100,7 @@ protected:
virtual bool eventTest(QEvent *e) const {
return (e->type() == QEvent::User+2);
}
- virtual void onTransition()
+ virtual void onTransition(QEvent *)
{
machine()->postEvent(new PongEvent(), 500);
fprintf(stdout, "pong!\n");