From: Laszlo Agocs Date: Sat, 24 Mar 2012 08:03:58 +0000 (+0200) Subject: Correct double, triple click handling in canvas when in touch mode X-Git-Tag: qt-v5.0.0-alpha1~14 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;ds=sidebyside;h=ea9ffebecd29887ad44b952ab02824072af6bb32;p=profile%2Fivi%2Fqtdeclarative.git Correct double, triple click handling in canvas when in touch mode The correct MouseArea signal sequence for a triple click is press, release, click, press, doubleclick, release, press, release, click. However QQuickCanvas sent the doubleclick before the press and did not reset the timestamp of the last press, resulting in a sequence with multiple doubleclicks and missing press signals. Change-Id: Ied5f3ea93d3ad28128ce7db5c8190ab48961da6d Reviewed-by: Martin Jones --- diff --git a/src/quick/items/qquickcanvas.cpp b/src/quick/items/qquickcanvas.cpp index 6c96482..3a9820d 100644 --- a/src/quick/items/qquickcanvas.cpp +++ b/src/quick/items/qquickcanvas.cpp @@ -389,7 +389,17 @@ void QQuickCanvasPrivate::translateTouchToMouse(QTouchEvent *event) bool doubleClick = event->timestamp() - touchMousePressTimestamp < static_cast(qApp->styleHints()->mouseDoubleClickInterval()); touchMousePressTimestamp = event->timestamp(); + QQuickMouseEventEx me = touchToMouseEvent(QEvent::MouseButtonPress, p); + me.setTimestamp(event->timestamp()); + me.setAccepted(false); + me.setCapabilities(event->device()->capabilities()); + deliverMouseEvent(&me); + if (me.isAccepted()) { + touchMouseId = p.id(); + event->setAccepted(true); + } if (doubleClick) { + touchMousePressTimestamp = 0; QQuickMouseEventEx me = touchToMouseEvent(QEvent::MouseButtonDblClick, p); me.setTimestamp(event->timestamp()); me.setAccepted(false); @@ -407,15 +417,6 @@ void QQuickCanvasPrivate::translateTouchToMouse(QTouchEvent *event) } } } - QQuickMouseEventEx me = touchToMouseEvent(QEvent::MouseButtonPress, p); - me.setTimestamp(event->timestamp()); - me.setAccepted(false); - me.setCapabilities(event->device()->capabilities()); - deliverMouseEvent(&me); - if (me.isAccepted()) { - touchMouseId = p.id(); - event->setAccepted(true); - } if (touchMouseId != -1) break; } else if (p.id() == touchMouseId) {