From 2ecf1f5d8ae37bdb4624bd1e3888a65ec357f7b3 Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Thu, 8 Mar 2012 13:41:19 +1000 Subject: 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 --- src/quick/items/qquickcanvas.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/quick/items/qquickcanvas.cpp') 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) { -- cgit v1.2.3 From f2e1be963f885a6030136591414cdbda26d50695 Mon Sep 17 00:00:00 2001 From: Luis Gabriel Lima Date: Thu, 5 Jan 2012 15:19:26 -0300 Subject: Add mouse wheel events handler to MouseArea This patch was based on the attached patch in QTBUG-7369. It basically exposes the wheel events to MouseArea via the onWheel signal. The current API is based on the new QWheelEvent API introduced by this patch: http://codereview.qt-project.org/#change,12532 Task-number: QTBUG-7369 Change-Id: Id58513715c2d0ae81e3a69e9e1ed400bbae07507 Reviewed-by: Michael Brasser --- src/quick/items/qquickcanvas.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/quick/items/qquickcanvas.cpp') diff --git a/src/quick/items/qquickcanvas.cpp b/src/quick/items/qquickcanvas.cpp index d73701e2a1..643887360a 100644 --- a/src/quick/items/qquickcanvas.cpp +++ b/src/quick/items/qquickcanvas.cpp @@ -1185,7 +1185,8 @@ bool QQuickCanvasPrivate::deliverWheelEvent(QQuickItem *item, QWheelEvent *event QPointF p = item->mapFromScene(event->posF()); if (QRectF(0, 0, item->width(), item->height()).contains(p)) { - QWheelEvent wheel(p, event->delta(), event->buttons(), event->modifiers(), event->orientation()); + QWheelEvent wheel(p, p, event->pixelDelta(), event->angleDelta(), event->delta(), + event->orientation(), event->buttons(), event->modifiers()); wheel.accept(); q->sendEvent(item, &wheel); if (wheel.isAccepted()) { -- cgit v1.2.3