summaryrefslogtreecommitdiffstats
path: root/src/declarative/graphicsitems
diff options
context:
space:
mode:
authorJarkko T. Toivonen <ext-jarkko.t.toivonen@nokia.com>2012-01-24 13:12:07 (GMT)
committerQt by Nokia <qt-info@nokia.com>2012-02-03 14:25:17 (GMT)
commite4073fdea521c4b6c36461b51fc16f818c502cc3 (patch)
tree6cbefb6f85b2ad7ffeb2dcf7b374674d4f556c91 /src/declarative/graphicsitems
parent1b031759ddfdab9703dfecac13f1ed318da3dafe (diff)
downloadQt-e4073fdea521c4b6c36461b51fc16f818c502cc3.zip
Qt-e4073fdea521c4b6c36461b51fc16f818c502cc3.tar.gz
Qt-e4073fdea521c4b6c36461b51fc16f818c502cc3.tar.bz2
Fix pinch-zoom problem when application is deactivated
Deactivation can happen for example if some notification dialog opens on top of the application. In this case the PinchFinished signal was not emitted. It is fixed so that when the QDeclarativePinchArea component receives QEvent::WindowDeactivate event, the ongoing touch activity is cancelled, which causes the pinch to finish. Also if QEvent::TouchUpdate event is received without receiving QEvent::TouchBegin event first, the QEvent::TouchUpdate event will not cause the updatePinch() method to be called. Task-number: ou1cimx1#948030 Change-Id: Ib8b9e1a022415be06f1a8e778b887418f32c75ef Reviewed-by: Murray Read <ext-murray.2.read@nokia.com> Reviewed-by: Pasi Pentikäinen <ext-pasi.a.pentikainen@nokia.com>
Diffstat (limited to 'src/declarative/graphicsitems')
-rw-r--r--src/declarative/graphicsitems/qdeclarativepincharea.cpp11
-rw-r--r--src/declarative/graphicsitems/qdeclarativepincharea_p_p.h3
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;