summaryrefslogtreecommitdiffstats
path: root/tests
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 /tests
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 'tests')
-rw-r--r--tests/auto/qstatemachine/tst_qstatemachine.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/tests/auto/qstatemachine/tst_qstatemachine.cpp b/tests/auto/qstatemachine/tst_qstatemachine.cpp
index 5dfc758..94afe51 100644
--- a/tests/auto/qstatemachine/tst_qstatemachine.cpp
+++ b/tests/auto/qstatemachine/tst_qstatemachine.cpp
@@ -186,10 +186,10 @@ public:
: QState(parent) {}
QList<QPair<int, Event> > events;
protected:
- virtual void onEntry() {
+ virtual void onEntry(QEvent *) {
events.append(qMakePair(globalTick++, Entry));
}
- virtual void onExit() {
+ virtual void onExit(QEvent *) {
events.append(qMakePair(globalTick++, Exit));
}
};
@@ -204,7 +204,7 @@ protected:
virtual bool eventTest(QEvent *) const {
return true;
}
- virtual void onTransition() {
+ virtual void onTransition(QEvent *) {
triggers.append(globalTick++);
}
};
@@ -246,7 +246,7 @@ protected:
virtual bool eventTest(QEvent *e) const {
return (e->type() == m_type);
}
- virtual void onTransition() {}
+ virtual void onTransition(QEvent *) {}
private:
QEvent::Type m_type;
};
@@ -380,7 +380,7 @@ public:
{
}
- void onEntry()
+ void onEntry(QEvent *)
{
error = m_machine->error();
errorString = m_machine->errorString();
@@ -1367,7 +1367,7 @@ protected:
StringEvent *se = static_cast<StringEvent*>(e);
return (m_value == se->value) && (!m_cond.isValid() || (m_cond.indexIn(m_value) != -1));
}
- virtual void onTransition() {}
+ virtual void onTransition(QEvent *) {}
private:
QString m_value;
@@ -1384,11 +1384,11 @@ public:
{ m_value = value; }
protected:
- virtual void onEntry()
+ virtual void onEntry(QEvent *)
{
m_machine->postEvent(new StringEvent(m_value));
}
- virtual void onExit() {}
+ virtual void onExit(QEvent *) {}
private:
QStateMachine *m_machine;