Commit ea9ffebe authored by Laszlo Agocs's avatar Laszlo Agocs Committed by Qt by Nokia

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: 's avatarMartin Jones <martin.jones@nokia.com>
parent 97786226
......@@ -389,7 +389,17 @@ void QQuickCanvasPrivate::translateTouchToMouse(QTouchEvent *event)
bool doubleClick = event->timestamp() - touchMousePressTimestamp
< static_cast<ulong>(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) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment