diff options
author | Benjamin Poulain <benjamin.poulain@nokia.com> | 2009-10-02 19:11:55 +0200 |
---|---|---|
committer | Benjamin Poulain <benjamin.poulain@nokia.com> | 2009-10-02 19:20:34 +0200 |
commit | 31cddefea97be65cdcc0970c237418b5b8a8e1d5 (patch) | |
tree | a969bf0e24d05f31f53a9d9652969b8e5b083424 /demos/shared/arthurwidgets.h | |
parent | e3fa7e2f0fd8f69d3de96af9ba0b868bd3ccc07c (diff) | |
download | qt4-tools-31cddefea97be65cdcc0970c237418b5b8a8e1d5.tar.gz |
Add multitouch capabilities to the shared classes of the demo
Add multitouch feature to the HoverPoints and the ArthurWidget.
Multitouch is enabled by default for widgets using HoverPoints. The
ArthurWidget propagate the TouchEvents in order to have them handled by
a parent if a parent accept the touch events.
Reviewed-by: Denis Dzyubenko
Reviewed-by: Pierre Rossi
Diffstat (limited to 'demos/shared/arthurwidgets.h')
-rw-r--r-- | demos/shared/arthurwidgets.h | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/demos/shared/arthurwidgets.h b/demos/shared/arthurwidgets.h index aa70002427..7b02bcd5c3 100644 --- a/demos/shared/arthurwidgets.h +++ b/demos/shared/arthurwidgets.h @@ -49,13 +49,32 @@ #if defined(QT_OPENGL_SUPPORT) #include <QGLWidget> +#include <QEvent> class GLWidget : public QGLWidget { public: GLWidget(QWidget *parent) - : QGLWidget(QGLFormat(QGL::SampleBuffers), parent) {} + : QGLWidget(QGLFormat(QGL::SampleBuffers), parent) + { + setAttribute(Qt::WA_AcceptTouchEvents); + } void disableAutoBufferSwap() { setAutoBufferSwap(false); } void paintEvent(QPaintEvent *) { parentWidget()->update(); } +protected: + bool event(QEvent *event) + { + switch (event->type()) { + case QEvent::TouchBegin: + case QEvent::TouchUpdate: + case QEvent::TouchEnd: + event->ignore(); + return false; + break; + default: + break; + } + return QGLWidget::event(event); + } }; #endif |