aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Jones <martin.jones@nokia.com>2012-03-08 13:41:19 +1000
committerQt by Nokia <qt-info@nokia.com>2012-03-09 09:56:08 +0100
commit2ecf1f5d8ae37bdb4624bd1e3888a65ec357f7b3 (patch)
treea968eb94be28d766055bc01be9aaf9fec25924aa
parent6a7da3f592a0cd672ce076afd75eb810b5c17c4c (diff)
Handle QEvent::TouchCancel in QML_TRANSLATE_TOUCH_TO_MOUSE mode
Just remove the mouse grab. The elements will react to this and correct their state. Change-Id: I8b91295606eaface54aa95b1500e7b138d9bc82e Reviewed-by: Michael Brasser <michael.brasser@nokia.com>
-rw-r--r--src/quick/items/qquickcanvas.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/quick/items/qquickcanvas.cpp b/src/quick/items/qquickcanvas.cpp
index 461236d183..d73701e2a1 100644
--- a/src/quick/items/qquickcanvas.cpp
+++ b/src/quick/items/qquickcanvas.cpp
@@ -374,6 +374,14 @@ static QQuickMouseEventEx touchToMouseEvent(QEvent::Type type, const QTouchEvent
void QQuickCanvasPrivate::translateTouchToMouse(QTouchEvent *event)
{
+ if (event->type() == QEvent::TouchCancel) {
+ touchMouseId = -1;
+ if (!mouseGrabberItem)
+ return;
+ mouseGrabberItem->ungrabMouse();
+ mouseGrabberItem = 0;
+ return;
+ }
for (int i = 0; i < event->touchPoints().count(); ++i) {
QTouchEvent::TouchPoint p = event->touchPoints().at(i);
if (touchMouseId == -1 && p.state() & Qt::TouchPointPressed) {