summaryrefslogtreecommitdiffstats
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
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
-rw-r--r--doc/src/snippets/statemachine/eventtest.cpp34
-rw-r--r--src/corelib/kernel/qcoreevent.cpp2
-rw-r--r--src/corelib/statemachine/qabstracttransition.cpp12
3 files changed, 47 insertions, 1 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;
+}
diff --git a/src/corelib/kernel/qcoreevent.cpp b/src/corelib/kernel/qcoreevent.cpp
index c636716..a682fad9 100644
--- a/src/corelib/kernel/qcoreevent.cpp
+++ b/src/corelib/kernel/qcoreevent.cpp
@@ -219,6 +219,7 @@ QT_BEGIN_NAMESPACE
\value WindowStateChange The \l{QWidget::windowState()}{window's state} (minimized, maximized or full-screen) has changed (QWindowStateChangeEvent).
\value WindowTitleChange The window title has changed.
\value WindowUnblocked The window is unblocked after a modal dialog exited.
+ \value Wrapped The event is a wrapper for, i.e., contains, another event (QWrappedEvent).
\value ZOrderChange The widget's z-order has changed. This event is never sent to top level windows.
\value KeyboardLayoutChange The keyboard layout has changed.
\value DynamicPropertyChange A dynamic property was added, changed or removed from the object.
@@ -267,7 +268,6 @@ QT_BEGIN_NAMESPACE
\omitvalue NetworkReplyUpdated
\omitvalue FutureCallOut
\omitvalue CocoaRequestModal
- \omitvalue Wrapped
\omitvalue Signal
\omitvalue WinGesture
*/
diff --git a/src/corelib/statemachine/qabstracttransition.cpp b/src/corelib/statemachine/qabstracttransition.cpp
index 670aa7d..c040c58 100644
--- a/src/corelib/statemachine/qabstracttransition.cpp
+++ b/src/corelib/statemachine/qabstracttransition.cpp
@@ -330,6 +330,18 @@ QList<QAbstractAnimation*> QAbstractTransition::animations() const
This function is called to determine whether the given \a event should cause
this transition to trigger. Reimplement this function and return true if the
event should trigger the transition, otherwise return false.
+
+
+ Note that \a event is a QWrappedEvent, which contains a clone of
+ the event generated by Qt. For instance, if you want to check a
+ key press event, do the following:
+
+ \snippet doc/src/snippets/statemachine/eventtest.cpp 0
+
+ You need to check if \a event is a QWrappedEvent because Qt also
+ uses other events for internal reasons; you don't need to concern
+ yourself with these in any case.
+
*/
/*!