Propagate synthesized mouse events in parallel with touch.
authorShawn Rutledge <shawn.rutledge@nokia.com>
Tue, 26 Jun 2012 16:00:59 +0000 (18:00 +0200)
committerQt by Nokia <qt-info@nokia.com>
Thu, 28 Jun 2012 14:47:42 +0000 (16:47 +0200)
commit468626e99a90d6ac21cb311cde05c658ccb3b781
tree7ac0039994e4489ea19e27cb0840dfa000486cbb
parent4c1addd2c3b019d66b5c19fcd8ba9e0918e92978
Propagate synthesized mouse events in parallel with touch.

The old way of event propagation inside QQuickCanvas was to send the
touch event through all elements, and if it was accepted along the
way, stop. Otherwise generate a mouse event and propagate it through
the items in the same way.

With this patch the behavior is changed instead to do the propagation
in parallel.  The idea is to first send a touch, then a mouse event to
each QML item (in paint order) that can potentially handle the events.
When items filter their child elements, the same logic applies.

Other changes/clarifications:
- mouse events no longer get synthesized for more than one touch point
- TouchPoints can be distributed to multiple Items
- if an item accepts a touch point, it always gets updates, even if
  the point is stationary
- events containing only stationary TouchPoints are discarded
- PinchArea must accept any initial single TouchPoint in order to
  receive subsequent updates, even though it's not pinching yet.
  This means if PA is on top, items underneath don't get touches.

New unit tests showing this behavior were added.

This patch was written by Frederik Gladhorn,
Laszlo Agocs and Shawn Rutledge.

Due to the complexity of the logic some refactoring was done.

QQuickMouseEventEx has been removed because it inherently relied on
using the QEvent d pointer.

Change-Id: If19ef687d7602e83cc11b18d2fecfbbdb4e44f5c
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@nokia.com>
23 files changed:
src/quick/items/qquickcanvas.cpp
src/quick/items/qquickcanvas_p.h
src/quick/items/qquickevents_p_p.h
src/quick/items/qquickflickable.cpp
src/quick/items/qquickitem.cpp
src/quick/items/qquickitem.h
src/quick/items/qquickmultipointtoucharea.cpp
src/quick/items/qquickpincharea.cpp
src/quick/items/qquickpincharea_p.h
tests/auto/quick/qquickcanvas/tst_qquickcanvas.cpp
tests/auto/quick/qquickmultipointtoucharea/tst_qquickmultipointtoucharea.cpp
tests/auto/quick/qquickpincharea/data/pinchproperties.qml
tests/auto/quick/qquickpincharea/tst_qquickpincharea.cpp
tests/auto/quick/quick.pro
tests/auto/quick/touchmouse/data/buttononflickable.qml [new file with mode: 0644]
tests/auto/quick/touchmouse/data/buttonontouch.qml [new file with mode: 0644]
tests/auto/quick/touchmouse/data/flickableonpinch.qml [new file with mode: 0644]
tests/auto/quick/touchmouse/data/mouseonflickableonpinch.qml [new file with mode: 0644]
tests/auto/quick/touchmouse/data/pinchonflickable.qml [new file with mode: 0644]
tests/auto/quick/touchmouse/data/singleitem.qml [new file with mode: 0644]
tests/auto/quick/touchmouse/data/twoitems.qml [new file with mode: 0644]
tests/auto/quick/touchmouse/touchmouse.pro [new file with mode: 0644]
tests/auto/quick/touchmouse/tst_touchmouse.cpp [new file with mode: 0644]