summaryrefslogtreecommitdiffstats
path: root/examples/animation/moveblocks
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/animation/moveblocks
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/animation/moveblocks')
-rw-r--r--examples/animation/moveblocks/main.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/examples/animation/moveblocks/main.cpp b/examples/animation/moveblocks/main.cpp
index eb23bd5..06ed3dd 100644
--- a/examples/animation/moveblocks/main.cpp
+++ b/examples/animation/moveblocks/main.cpp
@@ -101,7 +101,7 @@ protected:
&& (static_cast<StateSwitchEvent *>(event)->rand() == m_rand);
}
- virtual void onTransition() {}
+ virtual void onTransition(QEvent *) {}
private:
int m_rand;
@@ -116,7 +116,7 @@ public:
m_stateCount(0), m_lastIndex(0)
{ }
- virtual void onEntry()
+ virtual void onEntry(QEvent *)
{
int n;
while ((n = (qrand() % m_stateCount + 1)) == m_lastIndex)
@@ -124,7 +124,7 @@ public:
m_lastIndex = n;
m_machine->postEvent(new StateSwitchEvent(n));
}
- virtual void onExit() {}
+ virtual void onExit(QEvent *) {}
void addState(QState *state, QAbstractAnimation *animation) {
StateSwitchTransition *trans = new StateSwitchTransition(++m_stateCount);