summaryrefslogtreecommitdiffstats
path: root/examples/multitouch
diff options
context:
space:
mode:
authorBradley T. Hughes <bradley.hughes@nokia.com>2009-08-13 07:54:40 +0200
committerBradley T. Hughes <bradley.hughes@nokia.com>2009-08-13 07:56:15 +0200
commitde088b5a7f7b57e568399334667b14bfc9e7b893 (patch)
treecdcd94a9b70223e9c82d7ffdbf57a862fbf48acb /examples/multitouch
parent1070d82e13c43accf10ef24d5bbb82d681c1cf4f (diff)
Get the pinchzoom working again
Touch events on scrollarea based classes should enable touch on the viewport and handle the events in a viewportEvent() reimplementation.
Diffstat (limited to 'examples/multitouch')
-rw-r--r--examples/multitouch/pinchzoom/graphicsview.cpp6
-rw-r--r--examples/multitouch/pinchzoom/graphicsview.h2
2 files changed, 4 insertions, 4 deletions
diff --git a/examples/multitouch/pinchzoom/graphicsview.cpp b/examples/multitouch/pinchzoom/graphicsview.cpp
index 3d0e49f942..969f6045f6 100644
--- a/examples/multitouch/pinchzoom/graphicsview.cpp
+++ b/examples/multitouch/pinchzoom/graphicsview.cpp
@@ -47,11 +47,11 @@
GraphicsView::GraphicsView(QGraphicsScene *scene, QWidget *parent)
: QGraphicsView(scene, parent)
{
- setAttribute(Qt::WA_AcceptTouchEvents);
+ viewport()->setAttribute(Qt::WA_AcceptTouchEvents);
setDragMode(ScrollHandDrag);
}
-bool GraphicsView::event(QEvent *event)
+bool GraphicsView::viewportEvent(QEvent *event)
{
switch (event->type()) {
case QEvent::TouchBegin:
@@ -72,5 +72,5 @@ bool GraphicsView::event(QEvent *event)
default:
break;
}
- return QGraphicsView::event(event);
+ return QGraphicsView::viewportEvent(event);
}
diff --git a/examples/multitouch/pinchzoom/graphicsview.h b/examples/multitouch/pinchzoom/graphicsview.h
index 928fd164c3..e4ca65d73c 100644
--- a/examples/multitouch/pinchzoom/graphicsview.h
+++ b/examples/multitouch/pinchzoom/graphicsview.h
@@ -49,5 +49,5 @@ class GraphicsView : public QGraphicsView
public:
GraphicsView(QGraphicsScene *scene = 0, QWidget *parent = 0);
- bool event(QEvent *event);
+ bool viewportEvent(QEvent *event);
};