aboutsummaryrefslogtreecommitdiffstats
path: root/tests/manual/pointer
Commit message (Collapse)AuthorAgeFilesLines
* Add handlers declared as Flickable children to its contentItemShawn Rutledge2019-01-222-0/+160
| | | | | | | | | | | | | | | | | | | | | | | | | | QQuickItemPrivate::data_append() was not invoked when any kind of Pointer Handler was directly declared in a Flickable (or subclass) because QQuickFlickable redefines the default property to be its own flickableData property. So we need to repeat the special handling in QQuickFlickablePrivate::data_append() too. The handler must be added to the private->extra->pointerHandlers vector, so that QQuickItemPrivate::handlePointerEvent() will attempt to deliver events to those handlers. TapHandler seems OK (especially with its default gesturePolicy so that it does not do an exclusive grab). PointHandler seems OK. DragHandler competes with Flickable for the exclusive grab. pressDelay can help; or set acceptedDevices: PointerDevice.Mouse to allow the mouse to drag but not flick, and the touchscreen to flick but not drag. Fixes: QTBUG-71918 Fixes: QTBUG-73035 Change-Id: Icb97ed5230abe0cb6ec0230b5b5759a0528df7e8 Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* Use PointHandler for singlePointProperties manual testShawn Rutledge2018-08-301-24/+25
| | | | | | | | The name indicates that it should test a SinglePointHandler, which DragHandler no longer is. Change-Id: I3c585b43c1334cf6794a98c92f742f92243adac8 Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* Add sidebar manual test to the main pointer test launcherShawn Rutledge2018-08-062-0/+2
| | | | | Change-Id: I16356ee214c80ff23c6b520c7ad492f86d85f986 Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* Make pinch handler not activate on draggingJan Arve Sæther2018-08-021-0/+2
| | | | | | | | | | | | | | ..when dragging (translation) is disabled In order to do this, we had to integrate QQuickAxis to the PinchHandler which allows enabling/disabling x and y axis individually. This allows us to have one item with PinchHandler with translation disabled (but to only handle rotate and scale) together with a two-finger drag handler. Change-Id: I1581c575ffba2e5d007163bec36e5699bdd86cbc Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* TapHandler: emit eventPoint from the tapped signalsShawn Rutledge2018-07-271-13/+21
| | | | | | | | | | | | | | | | | | | | | | | | Any JS callback using one of these signals probably needs to know which button was tapped. We do not want to require TapHandler.point.pressedButtons to tell a lie (temporarily hold the previous state even though a button was actually released). We could add a releasedButtons property, but it would be a bit weird to have it holding state indefinitely between events. We could add just a button parameter to these signals, which would not be so bad, but emitting the whole eventPoint opens up other possibilities, like doing filtering in JS based on the device. To be able to get the device property of the event in QML, it must not be a const pointer. Q_PROPERTY(const type* ...) is so far unprecedented in Qt Quick; and the device has only const properties anyway. This reverts 8dc02aab72a714b5195ccc641fbfb534c3ae9e98 Task-number: QTBUG-61749 Task-number: QTBUG-64847 Change-Id: I09067498b22cc86e9f68c5ff13d6aa5447faba3d Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* Call clearGrabbers each time we get a press eventJan Arve Sæther2018-07-191-10/+10
| | | | | | | | | | | | | | | | | | | | | | | | | This is important in order for passive grabbers to be in the same order as if the points were pressed at the same time. In our case, the problem occurred when we had a single-point DragHandler together with a two-finger PinchHandler: * One finger was pressed and moved => DragHandler called setPassiveGrab() => point0->passiveGrabbers: [DragHandler] * A second finger was pressed and moved => PinchHandler called setPassiveGrab() for both points => point0->passiveGrabbers: [DragHandler,PinchHandler] => point1->passiveGrabbers: [PinchHandler] So then as one keeps on dragging the *two* fingers, the DragHandler will get the chance to do an exclusive grab first, (since its the first listed passive grabber of point0), and the PinchHandler won't get the opportunity to grab. This is not expected since their declaration order implies that the PinchHandler should get a chance to grab first. Change-Id: I4e82ed186eeb5bf1dae1679d393e5563072175d1 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Make DragHandler a MultiPointHandlerShawn Rutledge2018-07-194-26/+39
| | | | | | | | | | That is, minimumPointCount can now be set to a value > 1 to require multiple fingers to do the dragging, or to track the displacement of multiple fingers to adjust some value (such as the tilt of a map). Task-number: QTBUG-68106 Change-Id: Ib35823e36deb81c8b277d3070fcc758c7c019564 Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* Get rid of Qt.labs.handlers import, merge into QtQuick 2.12Shawn Rutledge2018-07-1731-59/+36
| | | | | | | ... and clean up imports in examples, snippets and tests accordingly. Change-Id: I5bbe63afd2614cdc2c1ec7d179c9acd6bc03b167 Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* Replace MultiPtHndlr.pointDistanceThreshold with PointerHandler.marginShawn Rutledge2018-06-292-0/+4
| | | | | | | | | | | | | | | | It's not just useful for PinchHandler: TapHandler has a good use for it too. But unfortunately if the handler's parent Item has a custom mask, we don't have a way to augment the mask with a margin; so if margin is set, we assume the bounds are rectangular. QQuickMultiPointHandler::eligiblePoints() now calls wantsEventPoint() rather than bounds-checking the point directly: this adds flexibility, potentially allowing an override in subclasses, if we need it later. Task-number: QTBUG-68077 Change-Id: I65c95f00c532044a5862654e58c9c5f8c973df81 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Add HoverHandler to detect a hovering mouse pointerShawn Rutledge2018-06-281-0/+186
| | | | | | | | | | Detect whether the handler's parent contains the mouse, while the point property tracks the event point (position etc.) Task-number: QTBUG-68072 Change-Id: Ica99332596eab3e344852a11f1ceb7aaf6348c86 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* PinchHandler: rename scale to activeScale; scale means target scaleShawn Rutledge2018-06-271-1/+7
| | | | | | | | | | | | If you want to set target: null and then bind scale to some sort of rendering scale property directly, it's a lot less trouble if the scale property does not keep changing back to 1.0 every time a gesture begins. Added an activeScale property to represent that value, the one that the scale property had before. Task-number: QTBUG-68941 Change-Id: Idcb6735d915a523afe1a948609080af7a83f82ad Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* Add QQuickHandlerPoint::modifiers propertyShawn Rutledge2018-05-181-2/+3
| | | | | | | | | The event includes it; this exposes it to QML, for the benefit of conditional JS logic in Pointer Handler use cases. Task-number: QTBUG-68101 Change-Id: I3f04c5db7f5aef461edb6168922b70e3fb3bda37 Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* MultiPointHandler: add a centroid propertyShawn Rutledge2018-05-182-4/+4
| | | | | | | | | | | | | | | One of the reasons we were so fond of using SinglePointHandler for the "simple" handlers like TapHandler and DragHandler is that it has the point property, which is easy to bind to in QML. But multi-point handlers tend to use the centroid as the focal point or fulcrum of the transformation, so exposing the centroid as a QQuickHandlerPoint gadget rather than just a QPointF has all the same advantages as the point property in SinglePointHandler, including letting the QQuickHandlerPoint instance store state between events (press position, grab position, last known position etc.) Change-Id: I4a955fa21b54b7ebb50b0ee2c942fb98eeccb560 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Manual test: combinations of DragHandler and TapHandler on FlickableJan Arve Saether2018-03-029-4/+628
| | | | | | | | | | | | | | | We already had a manual test using a slider, but that has only one combination of DragHandler and TapHandler. This test aims to test all possible combinations of DragHandler and TapHandler together (as siblings, in different parts of the hierarcy, with a Flickable beneath...) We also show the current grabbers as an overlay over this entire collection of manual tests. Change-Id: Ic634d36d14f7456170f43b077fa72b03fb65bc18 Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* flingAnimation manual test: add velocity vectors; install a ball returnShawn Rutledge2017-12-131-3/+57
| | | | | | | | | | Just like the one at the bowling alley... no actually the problem was that it's easy to fling the balls right out of the window, and we don't have collision detection so we can't make them bounce. Now they simply come back "home" after a delay. Change-Id: I297828321fce975b929e449e56799fd9280b682d Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* map manual test: re-render the SVG after significant change in scaleShawn Rutledge2017-12-111-2/+11
| | | | | | | | | The reason for using SVG is to be able to render it quickly at lower resolutions but with higher quality after zooming in, and it's good to have an example which demonstrates how. Change-Id: I04107b724ef5c844c8b3eaa2f46750bd66d7d718 Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* TapHandler manual test: remove console.log with tapped buttonShawn Rutledge2017-12-021-1/+0
| | | | | | | | | It's currently not possible to see which button was tapped, in JavaScript. 8dc02aab72a714b5195ccc641fbfb534c3ae9e98 broke it. Task-number: QTBUG-64847 Change-Id: I1020a8fa5732230d579ee7785e51b0e297df71b0 Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* pointer manual test: add svg to the .proShawn Rutledge2017-11-291-1/+1
| | | | | | | | | Otherwise the map example doesn't work when installing into app packages, because the svg plugin doesn't get included. Task-number: QTBUG-64851 Change-Id: I6674b8e4175262dfed74144280470c3e6b4c1524 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* add mouse feedback to PointerHandlers manual testShawn Rutledge2017-11-243-0/+82
| | | | | Change-Id: I598093647da3aba291945819d7c396a247fddf52 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* add touchpoint feedback to PointerHandlers manual testShawn Rutledge2017-11-244-0/+91
| | | | | Change-Id: I7f4783b6f9a5237ef6b8ae1a89fedaf9cdadffc5 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* give the joystick manual test a "case"Shawn Rutledge2017-11-233-28/+42
| | | | | | | | | The background image is a POV-ray rendering which makes it look a bit more like an actual joystick (but there's still no tilting stem under the knob). Change-Id: I9d130d6fcd72715733678a525c69785e5f1a52ea Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Fix outdated BSD license headerKai Koehne2017-11-1526-714/+402
| | | | | Change-Id: Ib1fe267c23ea9fce9bcc0a91ed61081260338460 Reviewed-by: Liang Qi <liang.qi@qt.io>
* pinchHandler manual test: more PinchHandlers; TapHandler for z-orderShawn Rutledge2017-11-141-58/+101
| | | | | | | grabPermissions are OK by default. Change-Id: I1e9564415a12e4cd7a9213d11e5374d619239099 Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* Let passive-grabbing PointerHandlers see all point updatesShawn Rutledge2017-11-141-1/+2
| | | | | | | | | | | 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>
* replace MultiPointHandler::requiredPointCount with min/max range propsShawn Rutledge2017-09-292-2/+2
| | | | | | | | 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>
* rename TapHandler.isPressed property to pressedShawn Rutledge2017-09-124-7/+7
| | | | | | | | | 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>
* FakeFlickable: returnToBounds only on axes which need itShawn Rutledge2017-09-111-34/+21
| | | | | | | | If you flick in such a way that y is within bounds but x is out of bounds, then returnToBounds should not change y; and vice-versa. Change-Id: I156a2f6e28bdcd6aecce35e639acaa05e55ee382 Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* singlePointHandlerProperties manual test fixesShawn Rutledge2017-09-081-1/+2
| | | | | | | | | | | After 2617ac5b9df7dfdecf0cb02d5933c40df1a55bbc the point.pos properties are renamed. We need to accept all buttons in order to show feedback for middle and right clicks. Change-Id: I2dce1b14c4ac94ffac7b8ed3ecc12938067a434c Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* pointerhandler manual tests: enable hi-dpi scaling by defaultShawn Rutledge2017-08-251-0/+1
| | | | | Change-Id: I6af55e11f02592f122be54d3d235c69537f3f7fc Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Move properties into grouped "point" propertyJan Arve Saether2017-05-238-36/+39
| | | | | Change-Id: I80000110a2e0ca69210322a0fcc587d86158358e Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* FakeFlickable: animate returnToBounds() when flicking is doneShawn Rutledge2017-05-221-8/+41
| | | | | | | | | It looks much nicer than just jerking back into position. We still don't have "resistance" to dragging past the bounds, though. Change-Id: I60f6f58fe87638fd17144ea6640bae673a3b633d Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* tst_flickableinterop: test buttons with all gesturePolicy valuesShawn Rutledge2017-05-151-1/+1
| | | | | Change-Id: If3d9e10bb54fc75a7e72bc6367de3e083611a45f Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* DragHandler: allow parent to be different from targetShawn Rutledge2017-04-271-7/+9
| | | | | | | | | | | | | | | The most obvious way to implement a Slider is to allow dragging the knob - as on a real-world physical sliding potentiometer. But to make it easier on a touchscreen, it should be possible to touch anywhere along the slider's travel, as on a QtQuick.Controls 2 Slider. For that purpose, we need to respond to events within the bounds of one Item while actually dragging a different Item (the knob). It's similar to the way that PinchHandler can handle pinch gestures within one Item while transforming another (which may be too small to get both fingers inside). Change-Id: Iac9a5f11a7a45e22d93fe52bf62d157c48d72d3d Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* add pinchDragFlingMPTA exampleShawn Rutledge2017-04-251-0/+97
| | | | | | | | | | | | | | | This is a prototype of what 3-finger pinch is intended for: manipulating a container exclusively with a 3-finger gesture while not interfering at all with other gestures that occur inside the container. And it's normal that existing Items (like MPTA) do implicit grabs of touchpoints just by accepting, so this is also a test of cooperation between PointerHandlers and legacy Areas. It also adds the ability to drag the MPTA only while the Meta key is held down. And there is momentum on release whether you are doing a 3-finger pinch or via the DragHandler. Change-Id: Icd0e84809ec32dc8f347dd9c8f875d10f52eba19 Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* QQuickPointerDeviceHandler: add acceptedModifiersShawn Rutledge2017-04-252-0/+59
| | | | | | | | | Sometimes you want to require holding down a key in order to enable some interaction. As with the other "accepted" flags, it's better to do this with a property than with Javascript. Change-Id: Ie29880f5f9f496ddca1bee462e2c0e6dd30fa9f5 Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* PH manual tests: better object names for easier debuggingShawn Rutledge2017-04-202-1/+3
| | | | | Change-Id: Icd5b9dc5fa00c98cc40b03e9d72f6b28fc51a579 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* PinchHandler: add centroidVelocityShawn Rutledge2017-04-201-0/+7
| | | | | Change-Id: I34cc9146155bded8311c1173e4b8d34d8b17b034 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Red frame indicates that the item has an active handlerJan Arve Saether2017-03-091-1/+8
| | | | | Change-Id: I360063f3fe80eefb112b348d1b93f38d34416696 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* add ScrollBar manual testShawn Rutledge2017-03-073-0/+190
| | | | | | | | | | | | It demonstrates that DragHandler's grabs work well enough, so that you can grab the knob and drag it even while the cursor goes outside the window. Also the TapHandler for detecting clicks or taps within the "trough". And for completeness, the FakeFlickable example needed scrollbars, to prove that it's possible to build all the flicking and scrolling behaviors with only PointerHandlers. Change-Id: I9d9323b1f583a02e0157edb85b6bffbe1652711f Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* TapHandler manual test: demonstrate tapped signalShawn Rutledge2017-03-072-7/+8
| | | | | | | | | | | Missiles are too expensive to launch in continuous sprays anyway. Also, it's too hard to keep holding down the "balloons" button if we use policy DragThreshold. This is better to have on the fighters button, since the usual use case is that ballons are launched first, and cheap enough to launch continuously. Change-Id: I3b52556b81afad9fb7ec1a4b1dec4dde3bab104c Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* flickableWithHandlers manual test improvementsShawn Rutledge2017-02-223-21/+47
| | | | | | | | Add it to main.qml and it and its dependencies to resources Add checkbox to control Flickable's pressDelay Change-Id: Ifaa4bbbaf61944231ab80cf356d7a3c44b24d73b Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* allow stealing grab from handlers; notify passive grabbers when stolenShawn Rutledge2017-02-161-1/+1
| | | | | | | | | | | | | 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>
* pointer handlers manual test: can give arg with qml to launchShawn Rutledge2017-02-142-0/+16
| | | | | | | | | This makes it easier to repeatedly launch the same test: specify the qml file on the command line instead of having to click the list item each time. e.g. ./pointer tapHandler.qml Change-Id: I30b449b161107b1746418fc45518d202ba7d8381 Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* TapHandler: add timeHeld propertyShawn Rutledge2017-02-091-1/+15
| | | | | | | It enables long-press gestures to have continuous feedback. Change-Id: Idd0838aff6213ebfc2fce66639bbc932e77208b4 Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* TapHandler: add gesturePolicyShawn Rutledge2017-02-0911-2/+290
| | | | | | | | | | | | | | Until now it behaved as if this was set to DragThreshold: give up on the tap as soon as you are clearly dragging rather than tapping. But that's not what is normally wanted when building a Button control, for example. So provide 3 options: give up past the drag threshold, when the pointer goes outside the bounds, or when it's released outside the bounds. The longPressThreshold also constrains all three cases: holding (or dragging) for too long will not result in an immediate cancellation, but it also will not be a tap gesture. Change-Id: I95aec978e783892b55371391a27642751d91d9ff Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* TapHandler: add long-press featureShawn Rutledge2017-02-091-5/+14
| | | | | | | | Add a longPressed signal, emitted when the point is held long enough. Add the longPressThreshold to control how long that is. Change-Id: I95a65f1e4c62eb41fb9ea02b14bdc3f16aa72ec2 Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* add flickableWithHandlers manual testShawn Rutledge2017-02-095-0/+464
| | | | | | | | to verify that Flickable still works after the changes in event delivery logic, even when it contains a mix of various Areas and Handlers. Change-Id: Ibf68bc8b403718c87c7e647b17837f2a8e4e3f0e Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* Introduce TapHandlerShawn Rutledge2017-02-083-0/+138
| | | | | | | | | Device-agnostic tap/click detection. Also detect whether the taps or clicks occur close enough together in both time and space to be considered part of a multi-tap gesture. Change-Id: I41a378feea3340b9f0409118273746a289641d6c Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* add modified photosurface as a manual testShawn Rutledge2017-02-083-1/+178
| | | | | | | | This is a version of examples/quick/demos/photosurface updated to use handlers instead of Areas. Change-Id: I80a6c46f2ea4821097f3654cd885553aa484d405 Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* add FakeFlickable manual testShawn Rutledge2017-02-084-0/+180
| | | | | | | | Demonstrate that DragHandler, MomentumAnimation and a couple of Items are enough to implement most of Flickable's functionality. Change-Id: I59dae38dc66c16813385aa6c00e3a1a834520f31 Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>