summaryrefslogtreecommitdiffstats
path: root/doc/src/snippets/statemachine
diff options
context:
space:
mode:
authorGeir Vattekar <geir.vattekar@trolltech.com>2009-07-17 11:44:44 (GMT)
committerGeir Vattekar <geir.vattekar@trolltech.com>2009-07-17 11:47:47 (GMT)
commit05ae1e2cf1c1d95377b302a6b4599358107c63b1 (patch)
tree66aa04e4ab7cf82c54567d5b4dcc12ec79bce480 /doc/src/snippets/statemachine
parent1aa43fc4af995374c577a951fd2054d696aa3b14 (diff)
downloadQt-05ae1e2cf1c1d95377b302a6b4599358107c63b1.zip
Qt-05ae1e2cf1c1d95377b302a6b4599358107c63b1.tar.gz
Qt-05ae1e2cf1c1d95377b302a6b4599358107c63b1.tar.bz2
Doc: Added info on QWrappedEvent to QAbstractTransition::eventTest()
Reviewed-by: Kent Hansen
Diffstat (limited to 'doc/src/snippets/statemachine')
-rw-r--r--doc/src/snippets/statemachine/eventtest.cpp34
1 files changed, 34 insertions, 0 deletions
diff --git a/doc/src/snippets/statemachine/eventtest.cpp b/doc/src/snippets/statemachine/eventtest.cpp
new file mode 100644
index 0000000..e0f359a
--- /dev/null
+++ b/doc/src/snippets/statemachine/eventtest.cpp
@@ -0,0 +1,34 @@
+
+#include <QtGui>
+
+class MyTransition : public QAbstractTransition
+{
+ Q_OBJECT
+public:
+ MyTransition() {}
+
+protected:
+//![0]
+ bool eventTest(QEvent *event)
+ {
+ if (event->type() == QEvent::Wrapped) {
+ QEvent *wrappedEvent = static_cast<QWrappedEvent *>(event)->event();
+ if (wrappedEvent->type() == QEvent::KeyPress) {
+ QKeyEvent *keyEvent = static_cast<QKeyEvent *>(wrappedEvent);
+ // Do your event test
+ }
+ }
+ return false;
+ }
+//![0]
+
+ void onTransition(QEvent *event)
+ {
+
+ }
+};
+
+int main(int argv, char **args)
+{
+ return 0;
+}