diff options
Diffstat (limited to 'src/declarative/graphicsitems')
-rw-r--r-- | src/declarative/graphicsitems/qdeclarativepincharea.cpp | 11 | ||||
-rw-r--r-- | src/declarative/graphicsitems/qdeclarativepincharea_p_p.h | 3 |
2 files changed, 11 insertions, 3 deletions
diff --git a/src/declarative/graphicsitems/qdeclarativepincharea.cpp b/src/declarative/graphicsitems/qdeclarativepincharea.cpp index 3d79f7a..bc97613 100644 --- a/src/declarative/graphicsitems/qdeclarativepincharea.cpp +++ b/src/declarative/graphicsitems/qdeclarativepincharea.cpp @@ -278,7 +278,10 @@ bool QDeclarativePinchArea::event(QEvent *event) return QDeclarativeItem::event(event); switch (event->type()) { case QEvent::TouchBegin: - case QEvent::TouchUpdate: { + d->touchEventsActive = true; + // No break, continue to next case. + case QEvent::TouchUpdate: + if (d->touchEventsActive) { QTouchEvent *touch = static_cast<QTouchEvent*>(event); d->touchPoints.clear(); for (int i = 0; i < touch->touchPoints().count(); ++i) { @@ -287,9 +290,13 @@ bool QDeclarativePinchArea::event(QEvent *event) } } updatePinch(); + return true; } - return true; + break; + case QEvent::WindowDeactivate: + // No break, continue to next case. case QEvent::TouchEnd: + d->touchEventsActive = false; d->touchPoints.clear(); updatePinch(); break; diff --git a/src/declarative/graphicsitems/qdeclarativepincharea_p_p.h b/src/declarative/graphicsitems/qdeclarativepincharea_p_p.h index b6993e9..53d0dff 100644 --- a/src/declarative/graphicsitems/qdeclarativepincharea_p_p.h +++ b/src/declarative/graphicsitems/qdeclarativepincharea_p_p.h @@ -71,7 +71,7 @@ public: , pinchRejected(false), pinchActivated(false) , pinch(0), pinchStartDist(0), pinchStartScale(1.0) , pinchLastScale(1.0), pinchStartRotation(0.0), pinchStartAngle(0.0) - , pinchLastAngle(0.0), pinchRotation(0.0) + , pinchLastAngle(0.0), pinchRotation(0.0), touchEventsActive(false) { } @@ -90,6 +90,7 @@ public: bool inPinch : 1; bool pinchRejected : 1; bool pinchActivated : 1; + bool touchEventsActive : 1; QDeclarativePinch *pinch; QPointF sceneStartPoint1; QPointF sceneStartPoint2; |