aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/quick/pointerhandlers
Commit message (Collapse)AuthorAgeFilesLines
* Fix outdated BSD license headerKai Koehne2017-11-1513-356/+200
| | | | | Change-Id: Ib1fe267c23ea9fce9bcc0a91ed61081260338460 Reviewed-by: Liang Qi <liang.qi@qt.io>
* Let passive-grabbing PointerHandlers see all point updatesShawn Rutledge2017-11-142-38/+63
| | | | | | | | | | | even if all points are accepted or grabbed. A passive grab isn't much good if there are cases where the handler is prevented from monitoring. This enables e.g. the PinchHandler to steal the grab when the right number of touchpoints are present and have moved past the drag threshold, and enables completion of a couple of autotests. Change-Id: I78dc6fc585f80bfb3c13e0c6e757ef815fb94afe Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* QQuickEventPoint: make ungrab/cancel notifications more consistentShawn Rutledge2017-11-141-8/+8
| | | | | | | | | | setGrabberPointerHandler is now implemented more similarly to setGrabberItem. One improvement is that in tests/manual/pointer/pinchDragFlingMPTA.qml the MPTA deactivates when the PinchHandler takes over its touchpoint grabs. Change-Id: I0bd4f143b5f25f1b393839f86c2a7802f1fa1886 Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* Fix a bug with TapHandler+DragHandler on top of FlickableJan Arve Sæther2017-10-272-1/+154
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If an item that had a TapHandler and a DragHandler was placed inside a Flickable it would call sendFilteredPointerEvent() for each of the handlers, even if they were siblings. This is not ideal, and because of a mechanism in flickable it even caused the DragHandler to not drag the item as expected. This is because of a mechanism in Flickable where the value returned is actually derived from the previous call to filterMouseEvent() (stored in member variable stealGrab). Below are the relevant steps it went through when the mouse drag exceeded the drag threshold (mouse pointer started on the item): Precondition: QQuickFlickablePrivate::stealMouse == false 1. Mouse Drag (which exceeded drag threshold) 2. sendFilteredPointerEvent(tapHandler->parentItem()) returns false. (but since it moved beyond threshold, it would set stealGrab-> true). 3. tapHandler->handlePointerEvent() declined and ungrabbed (due to DragThreshold gesture policy). 4. sendFilteredPointerEvent(dragHandler->parentItem()) returns true (because the previous call to sendFilteredPointerEvent() set stealGrab to true). As a consequence of (4), dragHandler->handlePointerEvent() was not called, and the flickable would start to flick instead of the item starting to drag. Change-Id: Ia99eae91cad0903ebbaedaaafcdf92a25705a922 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* replace MultiPointHandler::requiredPointCount with min/max range propsShawn Rutledge2017-09-291-1/+1
| | | | | | | | This is more flexible in case someone wants a PinchHandler to respond in the same way for either 2 or 3 touchpoints, for example. Change-Id: I360ce6f0239d86aa92dbebc225e3646883e71100 Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* change the type of DragHandler::translation to QVector2D; document itShawn Rutledge2017-09-291-1/+1
| | | | | | | | For consistency we use QVector2D to represent relative movements in all Pointer Handlers. Change-Id: I23dc20c360b482a995d232e8a6d7e87d9bd8f600 Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* rename TapHandler.isPressed property to pressedShawn Rutledge2017-09-125-12/+12
| | | | | | | | | This is for the sake of convention. Unfortunately (and the reason it wasn't done this way at the outset), it may prevent us from ever having a signal called "pressed" in this handler or its base class. Change-Id: Iafa117410e0e33562290b87df59bc8c0085c217d Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* rename QQuickEventPoint pos properties to positionShawn Rutledge2017-09-051-2/+2
| | | | | | | | For consistency we always spell it out, although it does make some of these properties inconveniently verbose. Change-Id: I64a08c3aa261c0ab89e09472dd47510abafbf7ca Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* Merge remote-tracking branch 'origin/dev' into wip/pointerhandlerJan Arve Saether2017-07-112-5/+3
| | | | | | | | | | | Conflicts: examples/quick/shared/LauncherList.qml src/quick/items/qquickevents.cpp src/quick/items/qquickevents_p_p.h src/quick/items/qquickwindow.cpp tests/auto/quick/touchmouse/tst_touchmouse.cpp Change-Id: Id692d291455093fc72db61f1b854f3fc9190267b
* Update according to new "point" API of single handlerJan Arve Saether2017-05-311-1/+1
| | | | | Change-Id: Ia67dd04333a7879362819e1bb2a891c1f92b7069 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Add autotest for DragHandlerShawn Rutledge2017-05-299-0/+964
| | | | | Change-Id: I46f7e2c16b775723a08aa192845d490046231990 Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* Add tst_multipointtoucharea_interop autotestShawn Rutledge2017-05-274-0/+399
| | | | | | | | to test interoperability of PointerHandlers with conventional touch- handling Items (with MultiPointTouchArea being the prototypical instance) Change-Id: Id19f312b17b70df072d66cd91816d2b19250a500 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Add tst_PointerHandlers::touchReleaseOutsideShawn Rutledge2017-05-261-0/+57
| | | | | | | | to verify when a point is pressed on a PointerHandler, dragged outside, and released, the handler gets a release event, or a cancel. Change-Id: Icdcb67c5549aca605bc6e7b425978760330ba270 Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* tst_qquickpointerhandler: Test grab changesShawn Rutledge2017-05-241-61/+90
| | | | | | | | Now an Event could represent a QEvent, a PointerEvent, or a call to onGrabChanged, so we can test the sequence more thoroughly. Change-Id: Ib935cda8dfc87c37d917989423615688dc9c260c Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Fix autotests to run with the new APIJan Arve Saether2017-05-231-2/+2
| | | | | | | | 5d4f488bf30f5650051d6cc226a75dbd17cd9a70 changed some APIs, but it forgot to update all autotests. Change-Id: I2a0ca14dbc1a0dddcbad597389c00d5e6f6c8b79 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Move properties into grouped "point" propertyJan Arve Saether2017-05-231-2/+2
| | | | | Change-Id: I80000110a2e0ca69210322a0fcc587d86158358e Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* tst_qquickpointerhandler: Remove unused includes; better debug outputShawn Rutledge2017-05-191-19/+19
| | | | | Change-Id: I1e0539fe24e19ca15641fa4007488b33c24ab8ba Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
* tst_flickableinterop: test buttons with all gesturePolicy valuesShawn Rutledge2017-05-154-12/+70
| | | | | Change-Id: If3d9e10bb54fc75a7e72bc6367de3e083611a45f Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* tst_qquickpointerhandler: use QScopedPointer; improvementsShawn Rutledge2017-05-112-85/+113
| | | | | | | | | | | | | | | | | It's now standard practice in autotests to use QScopedPointer to manage the window so that it doesn't need to be deleted (or would be left dangling if the test fails). It's nice to be able to see the bounds of the EventItem. Test not only the order of the event types received, but the EventPoint state, and where they were received. Of course PointerEvents go only to PointerHandlers in this test so far... but now we can distinguish filtered events from events which were received via the QQuickItem virtual function overrides. Change-Id: I4830a431bedb7101c8c980ab3260d23b5852b645 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Add tst_flickableinterop: verify drag and tap handlers inside FlickableShawn Rutledge2017-04-287-0/+816
| | | | | | | | | | Flickable can steal the grab from a PointerHandler the same way it can steal from an Item: by filtering the children's events. But within the drag threshold, or if the DragHandler is dragging, the handlers behave normally. Change-Id: If1bc1f2e8d9aaebb590f3434a3018a9f1a1f1dac Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* TapHandler longPress autotest: be less demanding about hold timeShawn Rutledge2017-04-241-2/+2
| | | | | | | It's hitting slightly less than the expected amount of time in CI. Change-Id: I51ab1ee385045dd948f52e0c27e72ce627952fd6 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* add autotest for TapHandlerShawn Rutledge2017-04-216-0/+829
| | | | | | Change-Id: Idc516220365b3051e072506ede3f3159b0b736b2 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* clarify further exclusive vs. passive grabsShawn Rutledge2017-02-201-3/+3
| | | | | | | | | | Add documentation to the grab-related event and eventpoint methods. Rename "grabber" functions which relate only to the exclusive grab, in cases where it would otherwise be ambiguous. And a few other documentation changes. Change-Id: I1a203c8c06a19d4abdb000f08b387c38341ef476 Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* allow stealing grab from handlers; notify passive grabbers when stolenShawn Rutledge2017-02-161-14/+13
| | | | | | | | | | | | | Now if a Button with a TapHandler is pressed and has only a passive grab, Flickable can take the exclusive grab, and it notifies the TapHandler so that the button can go back to released state. This reverts parts of commit e2fd141372335f917c2d216051abb00d8b15f87c such that more of tst_PointerHandlers is working the same as it was before we started adding the passive grab concept. Change-Id: I88970716fcbbfb066a313fcefb233cf9263da944 Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* start making explicit exclusive or passive grabsShawn Rutledge2017-02-101-3/+3
| | | | | Change-Id: I4a6e3c72d69e893fec2e39f4faab24af6d00c7e0 Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* QQuickWindow: use QVector eventDeliveryTargets to avoid repeated deliveryShawn Rutledge2017-02-071-10/+8
| | | | | | | | | | | | | | | | If no handler or item accepts a newly-pressed point, the event will be re-delivered in deliverTouchEvent(). It doesn't make sense to re-deliver to the same handlers though. A temporary QSet isn't cheap to create, whereas it seems we will need to keep track of handlers which have already been visited, in order to avoid visiting passively-grabbing handlers multiple times. Since both a QVector and a QSet are heap-allocated, and we expect to have a limited quantity of handlers grabbing at one time, a retained QVector (cleared between events) seems to be the cheapest data structure. Change-Id: I831e9a2576b2fcb9095e065795f2baff58115a49 Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* QQuickWindow: deliver updates to handlers even if they don't grabShawn Rutledge2017-02-021-24/+33
| | | | | | | | | | The "weak grab" concept depends on this. First we deliver to grabbers, then we deliver to non-grabbing handlers (but not to non-grabbing items). Avoid re-delivering to grabbing handlers which already received the same event. Change-Id: If51e1cd9372e3bed1daea3758e9ef8e37c0ba5e3 Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* move qquickpointerhandler test to a subdirectoryShawn Rutledge2016-09-024-17/+24
| | | | | | | | Tests will become too complex to do them all in one class, so let's have a subdirectory for each handler. Change-Id: I157f6c150f15ca53d77bc9eb716723c6105e393a Reviewed-by: Jan Arve Sæther <jan-arve.saether@theqtcompany.com>
* QQuickEventPoint::grabber: allow grabbing either an item or a handlerShawn Rutledge2016-08-231-7/+6
| | | | | | | QQuickPointerHandler and QQuickItem have only QObject in common. Change-Id: I8fb68cc1779f42049db1e0eb5ff60019a1c674d3 Reviewed-by: Jan Arve Sæther <jan-arve.saether@theqtcompany.com>
* add PointerHandlers autotestsShawn Rutledge2016-08-173-0/+504
Starting with touchEventDelivery and mouseEventDelivery, and reflecting the current state of the code: a handler cannot yet be the grabber, so we don't yet deliver properly to both the legacy event handler functions and to the handler objects. Change-Id: Ied73663b97907431668cb2621260d2551052d737 Reviewed-by: Jan Arve Sæther <jan-arve.saether@theqtcompany.com>