aboutsummaryrefslogtreecommitdiffstats
path: root/tests/manual/pointer
Commit message (Collapse)AuthorAgeFilesLines
* 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>
* add MomentumAnimation as a manual test / experimentShawn Rutledge2017-02-084-0/+158
| | | | | | | | It could be exposed as a new type of animation, but for now it's just an experiment. Change-Id: Ic900752a90ccae93270e27399f370f5d47495f74 Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* QQPSingleHandler: copy some values from QQuickEventPoint to propertiesShawn Rutledge2017-01-039-0/+171
| | | | | | | | | We can't copy the eventpoint and we can't continue to refer to it after delivery, either. So we can't have an event property. Some QML use cases depend on being able to access last-known values between events. Change-Id: Ice8a1763015f2554275d0cb76824fd0366eaef56 Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* Add a DragHandler::translation propertyJan Arve Saether2016-12-293-0/+93
| | | | | | | | | | | | | | This allows the application developer to get the translation of the dragged pointer, and apply it in a custom way. This should usually be combined with setting target to null. This will for instance be needed when we want to drag QtLocations map, where a map is dragged by specifying the geo location of the center of the map. The map2.qml example demonstrates this. Change-Id: I652d9fc92fa9b6dfd3796c7147832f25af0cc5bc Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* DragHandler active property replaces dragging; same as grabbingShawn Rutledge2016-12-292-2/+2
| | | | | | | | | | | | | | | | | If a QQuickPointerSingleHandler grabs a point, it's definitely in the active state: doing something with the point. (The converse is not always true though: e.g. TapHandler can sometimes detect a tap without ever grabbing.) In DragHandler, the "dragging" property means the same as "active": we always grab when dragging, to be sure to get the updates. So the "dragging" property is removed because it's redundant. In QQuickPointerHandler we don't say that "wanting" an event is the same as being active, because 1) it won't necessarily grab right away and 2) every handler which was active should "want" the release event, yet it needs to setActive(false) as soon as it's done processing it. Change-Id: Ie010db54714a7914109da6469e79865f9a0a18e4 Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* Let pinchhandler operate on QQuickItem propertiesJan Arve Saether2016-12-271-15/+26
| | | | | | | | | | | | | | | | | | | | | | | | This requires coordinate system mapping that varies with the transformOrigin. The properties exposed from PinchHandler (rotation, scale and translation) are currently relative to the point when the pinch became active. (Therefore, rotation, will reset back to 0 when a new pinch is activated). Its still unclear how the properties that limits the transform should influence. With this patch, they are like this: * {min,max}imumRotation applies to the actual rotation of the item. * {min,max}imumScale applies to the actual scale of the item. * {min,max}imum{X,Y} applies to the actual position of the item. (This has some unfortunate side-effects when the item is scaled or rotated, since the items actual position will change as it rotates) In addition, the behavior described above means that the limits won't have any effect if there is no target item. Change-Id: I279fb03667cd75324e8337039ae2594658265d13 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Fixed some problems with the centroid in PinchHandlerJan Arve Saether2016-11-201-44/+52
| | | | | | | | | | | | The centroid was not always mapped to the correct coordinate system In addition, the return value of startingCentroid() was not always desirable, because its implementation calls sceneGrabPos(). We therefore had to get the starting centroid by querying touchPointCentroid() whenever the handler became active. Change-Id: I69de6b832b9bda208fda4eb90a8a95cc975405c2 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Fix rotation in PinchHandlerJan Arve Saether2016-09-161-6/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If we want to allow rotation with more than 2 fingers, its not straightforward to calculate the rotation angle, because we cannot anymore calculate the angle between the two touchpoints. The approach chosen was to calculate the angle between the centroid and the touchpoints, and take the average between the angles. Then, for the next event we calculated the new average of the angles. However, this is not really reliable in some scenarios, suppose we have these three angles: 0 120 240, avg = 360/3 = 120 next, touch points rotate clockwise with 2 degrees, and we get these angles: 358 118 238, avg = 714/3 = 238 So, just by rotating all fingers by 2 degrees, we got a jump by 118 degrees "in average". Instead we need to track the angles of *all* touch points, and when the next touch event is received we calculate how much the angle has changed per touch point. We then take the average of those angles as the effective "rotation" of the PinchHandler Change-Id: I2bfdf80b886751177efe81bcc7b698af0d2938e3 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* add a map example as a manual testShawn Rutledge2016-09-014-0/+77
| | | | | | | The public-domain map is adapted from https://openclipart.org/detail/67039/ Change-Id: Ia3da049174a38a6cc9e9632eda4f4553ad16d3bf Reviewed-by: Jan Arve Sæther <jan-arve.saether@theqtcompany.com>
* Introduce PinchHandlerShawn Rutledge2016-09-013-1/+95
| | | | | | | | | | | Similar to PinchArea but with improvements: - Allows rotating and scaling about an arbitrary point rather than the center - It's possible to require more than 2 fingers. E.g. maybe you use 3 fingers to manage a window, 2 fingers to manipulate content inside. This could be achieved with two independent PinchHandlers. Change-Id: Ifd40cfee115d7bc298378b26a58318bea40a8230 Reviewed-by: Jan Arve Sæther <jan-arve.saether@theqtcompany.com>
* Introduce DragHandlerShawn Rutledge2016-08-267-1/+272
| | | | | | | A handler for dragging Items around by touch or mouse. Change-Id: Id83fea568095eb6374f3f1abc6f550d81f3731df Reviewed-by: Jan Arve Sæther <jan-arve.saether@theqtcompany.com>
* add PointerHandler manual test projectShawn Rutledge2016-08-264-0/+119
QML manual tests will be added to test specific handlers later. Change-Id: I691cff23f97fc79020d1090448e70a78de3b4be9 Reviewed-by: Jan Arve Sæther <jan-arve.saether@theqtcompany.com>