diff options
author | Geir Vattekar <geir.vattekar@trolltech.com> | 2009-07-17 11:44:44 (GMT) |
---|---|---|
committer | Geir Vattekar <geir.vattekar@trolltech.com> | 2009-07-17 11:47:47 (GMT) |
commit | 05ae1e2cf1c1d95377b302a6b4599358107c63b1 (patch) | |
tree | 66aa04e4ab7cf82c54567d5b4dcc12ec79bce480 /doc/src/snippets/statemachine | |
parent | 1aa43fc4af995374c577a951fd2054d696aa3b14 (diff) | |
download | Qt-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.cpp | 34 |
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; +} |