From f8c5c2720b4a48dad0f68b83d9c494185e012cd1 Mon Sep 17 00:00:00 2001 From: Denis Dzyubenko Date: Thu, 12 Mar 2009 17:06:17 +0100 Subject: Moved the code that translated QGestureEvent to QGraphicsSceneGestureEvent to a viewport, so that the user could subscribe to gestures in a viewport as well. --- src/gui/graphicsview/qgraphicsview.cpp | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/src/gui/graphicsview/qgraphicsview.cpp b/src/gui/graphicsview/qgraphicsview.cpp index 925763c..6f142e3 100644 --- a/src/gui/graphicsview/qgraphicsview.cpp +++ b/src/gui/graphicsview/qgraphicsview.cpp @@ -2862,16 +2862,8 @@ bool QGraphicsView::event(QEvent *event) } } break; - case QEvent::Gesture: { - QGraphicsSceneGestureEvent gestureEvent; - gestureEvent.setWidget(this); - QGestureEvent *ev = static_cast(event); - gestureEvent.setGestures(ev->gestures()); - gestureEvent.setCancelledGestures(ev->cancelledGestures()); - QApplication::sendEvent(d->scene, &gestureEvent); - if (gestureEvent.isAccepted()) - return true; - } + case QEvent::Gesture: + viewportEvent(event); break; default: break; @@ -2953,6 +2945,17 @@ bool QGraphicsView::viewportEvent(QEvent *event) d->scene->d_func()->updateAll = false; } break; + case QEvent::Gesture: { + QGraphicsSceneGestureEvent gestureEvent; + gestureEvent.setWidget(this); + QGestureEvent *ev = static_cast(event); + gestureEvent.setGestures(ev->gestures()); + gestureEvent.setCancelledGestures(ev->cancelledGestures()); + QApplication::sendEvent(d->scene, &gestureEvent); + if (gestureEvent.isAccepted()) + return true; + } + break; case QEvent::TouchBegin: case QEvent::TouchUpdate: case QEvent::TouchEnd: -- cgit v0.12