aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/handlers
Commit message (Collapse)AuthorAgeFilesLines
* Add snapMode to DragHandlerJan Arve Sæther2019-05-162-2/+48
| | | | | | | | | | | | | | | | | This changes snap behavior slightly. Basically, it does not snap anymore if the target() item is an ancestor of the parentItem(). In addition, we add a property that enables users to change the behavior. (SnapIfPressedOutsideTarget has the old behavior) [ChangeLog][QtQuick][Event Handlers] Added DragHandler.snapMode which can be used to configure under which conditions the dragged item is snapped to be below the cursor. The default mode is SnapAuto. The old behavior can be obtained through the SnapIfPressedOutsideTarget mode. Fixes: QTBUG-75661 Change-Id: Ibc00e8fbe31b779f8e817af1505e76425467d27a Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Merge remote-tracking branch 'origin/5.13' into devQt Forward Merge Bot2019-05-161-6/+21
|\ | | | | | | Change-Id: I192cb06f3b92869699cb3e072f2c6c1e8dbb1ef4
| * Merge remote-tracking branch 'origin/5.12' into 5.13Qt Forward Merge Bot2019-05-161-6/+21
| |\ | | | | | | | | | Change-Id: Ia93dc734ce25b3134b0f905f473a0c30777ceaf1
| | * Document TapHandler.tapped and [single|double]Tapped eventPoint argumentShawn Rutledge2019-05-091-6/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Amends b8fd580cb3453b3850c36765c4b2537538d2f4f8 to add documentation. The eventPoint is important to get ephemeral state from the pointing device: which button was released (thus triggering the tap), which device it was, and where the release occurred. Users may expect to use the point property, but QQuickHandlerPoint::reset(QQuickEventPoint *) resets every property of the point at the same time, so the architecture currently does not allow for mixed state, i.e. having correct button state but still holding leftover position information. It may be surprising for users, but the changes to the point property are an atomic transaction that occurs before the signal. Task-number: QTBUG-61749 Task-number: QTBUG-64847 Change-Id: I33e0e232084beba8e10d8b02fa3bf85f36293358 Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* | | Merge remote-tracking branch 'origin/5.13' into devQt Forward Merge Bot2019-05-021-2/+2
|\| | | | | | | | | | | Change-Id: I5d2c3da38df35922b2147c3c0bc55c6c3bae2fe5
| * | Merge remote-tracking branch 'origin/5.12' into 5.13Qt Forward Merge Bot2019-05-011-2/+2
| |\| | | | | | | | | | Change-Id: Ic008bf9223a9ac293c925044355ff218f7ed7f78
| | * PinchHandler: change qCInfo to qCDebugShawn Rutledge2019-04-291-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | qCInfo is enabled by default, so this turns into noise for users. Task-number: QTBUG-70083 Change-Id: Ie7f50d393055846bd2f9935c2bbe72830b1b24a3 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* | | Merge remote-tracking branch 'origin/5.13' into devQt Forward Merge Bot2019-04-291-6/+7
|\| | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/qml/compiler/qv4compilercontext.cpp src/qml/qml/qqmlmetatype.cpp Change-Id: I02e0216961b92ff68a3f91a70edc33fe9e8db147
| * | Merge remote-tracking branch 'origin/5.12' into 5.13Qt Forward Merge Bot2019-04-271-6/+7
| |\| | | | | | | | | | Change-Id: I552629813ea8100d04ea19e51fe7198931082e19
| | * MultiPointHandler: eliminate "no points" warning with native gesturesShawn Rutledge2019-04-261-6/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In handlePointerEventImpl, there is the call d->centroid.reset(d->currentPoints); with the expectation that currentPoints is not empty. But we weren't populating it in case of a native gesture. It still ends up being empty at the end of the gesture, but it's normal to return false from wantsPointerEvent() when there are no eligible points. Fixes: QTBUG-70083 Change-Id: I12ca6460a24d2eb6c44a639f83ce3ff17eb37613 Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* | | Add WheelHandlerShawn Rutledge2019-04-274-0/+741
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It can be used to change any qreal property of its target Item in response to wheel rotation, or it can be used in other ways that involve bindings but without a target item. [ChangeLog][QtQuick][Event Handlers] Added WheelHandler, which handles mouse wheel rotation by modifying arbitrary Item properties. Fixes: QTBUG-68119 Change-Id: I247e2325ee993cc1b91a47fbd6c4ba0ffde7ad49 Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* | | QQuickMultiPointHandler::moveTarget(): work with interceptorsShawn Rutledge2019-04-152-2/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As with WheelHandler, DragHandler also needs to allow the target movements to be constrained with interceptors like BoundaryRule. Also do a null pointer check in moveTarget(): we haven't needed it before, but we are becoming more open to subclassing, so need to prevent user foot-shooting. Change-Id: I6b39b6dd2ca8245c56ecb3812e6de9624b36fa50 Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* | | Merge remote-tracking branch 'origin/5.13' into devQt Forward Merge Bot2019-04-101-4/+3
|\| | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/qml/qml/qqmlmetatype.cpp src/qml/types/qqmlmodelsmodule.cpp Change-Id: Idc63689ba98d83a455283674f4b5cf3014473605
| * | Merge remote-tracking branch 'origin/5.12' into 5.13v5.13.0-beta2Qt Forward Merge Bot2019-04-091-4/+3
| |\| | | | | | | | | | Change-Id: I68211a7d4568a1c31c6a124fe6777709c53736a5
| | * If DragHandler is dragged within its margin, don't jumpShawn Rutledge2019-04-051-4/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Not being pressed inside the target is a necessary but not sufficient reason to reset m_pressTargetPos to the center of the target. The intention was rather to make the target jump into position when the parent was a different item: e.g. if a Slider has a DragHandler whose target is the slider's knob, you can start dragging anywhere on the whole Slider but you want the knob to jump to the cursor position when the drag begins. While we're at it, both branches of the if in onGrabChanged() are checking that target() isn't null, so we can move that check out. Fixes: QTBUG-74966 Change-Id: I05be11d27422b070d941b9e43d4e1157e071c3a5 Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* | | Refactor transform code in pinchhandler to a separate functionJan Arve Sæther2019-04-021-21/+4
| | | | | | | | | | | | | | | | | | | | | This is needed in order for the wheel handler to have the same behavior. Change-Id: I42851789787b8da96618d82227b34c53ace15e9b Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* | | Refactor QQuickMultiPointHandler into public and private classesShawn Rutledge2019-04-026-74/+204
| | | | | | | | | | | | | | | Change-Id: Iec19664862bfbbf9a6c582dac441dda26eec57db Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* | | Get rid of m_startMatrix as a member variableJan Arve Sæther2019-04-022-10/+10
|/ / | | | | | | | | | | | | | | | | This is needed in order to refactor out the calculation of the items position due to rotation and scale around an arbitrary origin. Instead we calculate it on-demand for each touch update. Change-Id: I06ace836061c6881fe9bb58bff462d1f407b6365 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* | Add some missing QT_{BEGIN,END}_NAMESPACE macrosJan Arve Sæther2019-03-212-0/+7
| | | | | | | | | | Change-Id: I16820387279ca616af6ab379874c247c83df4a2f Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* | Export all private Input Handlers and related classesShawn Rutledge2019-03-189-12/+11
| | | | | | | | | | | | | | | | | | | | This was the intention already in 5.12, but we left it with Q_AUTOTEST_EXPORT until now. Users should be able to begin experiments with subclassing handlers, since that is intended to be officially supported in 5.14 with public headers. Change-Id: I89471b3ef748936059ed4444eac5348d26a3344b Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* | Merge remote-tracking branch 'origin/5.12' into 5.13Qt Forward Merge Bot2019-03-132-8/+15
|\| | | | | | | | | | | | | | | Conflicts: src/qml/compiler/qv4codegen.cpp src/qml/animations/qsequentialanimationgroupjob.cpp Change-Id: I8b76e509fd7c8599d4cef25181d790ee28edab54
| * Doc: Fix link issuesNico Vertriest2019-02-282-8/+15
| | | | | | | | | | Change-Id: I0e08820a6d25996fe27118f05214ff63d695d24e Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io>
* | Merge remote-tracking branch 'origin/5.12' into 5.13v5.13.0-alpha1Qt Forward Merge Bot2019-02-073-27/+55
|\| | | | | | | Change-Id: I5209d833e171c795556c075e2a5f964b59b6df2e
| * Fix bug where QQMPH kept an exclusive grab when no buttons were pressedJan Arve Sæther2019-02-061-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This happened if you moved the mouse while doing a multitouch operation. More specifically this caused the bug: 1. Open qtdeclarative/tests/manual/pointer/map.qml 2. Rotate the map with two fingers (Do not release fingers). 3. Move mouse (no buttons pressed). 4. Release both fingers. 5. Move mouse again (error: the draghandler has a grab and thus the map is dragged even if no buttons are down). This happened because if you moved the mouse while having two fingers down, Windows would generate a *mouse*move* event with Left button or Right button pressed (which wasn't the case on the physical device but it's probably because of a bug in how mouse events are synthesized from touch on Windows). This caused the QQuickMultiPointHandler to do a passive grab. Then, when releasing the fingers it would not send a mouse release event (just plain touch release events), so the QQuickMultiPointHandler would keep the passive grab it had. All subsequent mouse move events would then be dispatched to the QQuickMultiPointHandler where it would assume that the button was pressed until it got a release event (but button was never pressed so that wouldn't happen). Eventually it would perform an exclusive grab, and dragging was initiated. Change-Id: I42b3133c5fde93c7f92f1cb28705156a69f9ad1c Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
| * Merge remote-tracking branch 'origin/5.12.1' into 5.12Liang Qi2019-02-012-27/+51
| |\ | | | | | | | | | | | | | | | | | | Conflicts: src/quick/handlers/qquickpinchhandler.cpp Change-Id: I1f3618ceb93049623d6bf3a208b037c33d9d1f0c
| | * Fix axis constraints API and documentation:v5.12.1Jan Arve Sæther2019-01-212-27/+51
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This should have been done properly for 5.12. Since this API was introduced in 5.12.0, we simply hide the documentation for the old properties and make sure the properties we want to expose are documented: * Document the xAxis and yAxis properties. * Deprecate the {min,max}imum{X,Y} properties, and hide them in the documentation. Fixes: QTBUG-73137 Change-Id: Ic749bcfec63dc4772f193ccae2a2750c20cb63aa Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* | | Merge remote-tracking branch 'origin/5.12' into 5.13Liang Qi2019-02-011-1/+1
|\| | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/qml/compiler/qv4codegen.cpp Done-With: Erik Verbruggen <erik.verbruggen@qt.io> Change-Id: I3ae3d64317e4f3fccba6605f4c6da15479ca75e0
| * | TapHander: do not "want" an eventPoint that is outside parent boundsShawn Rutledge2019-01-301-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | So far it was checking parentContains() on press, release, or when the gesturePolicy is WithinBounds, but not for each movement when the policy is DragThreshold (the default). This might explain most of the remaining warning noise: "pointId is missing from current event, but was neither canceled nor released" because it was possible for TapHandler to remember wanting a point that it should not have wanted, but without taking any kind of grab, and then complaining when that point was no longer present. Since it did not grab, it did not get the release, unless the release was part of an event containing a point that it DID grab. Fixes: QTBUG-71887 Change-Id: I26ce62279574cf6b0150f24e486f224a604ac6b1 Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* | | Merge remote-tracking branch 'origin/5.12' into devLiang Qi2019-01-294-27/+31
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/3rdparty/masm/yarr/YarrJIT.cpp src/qml/compiler/qv4instr_moth.cpp src/quick/handlers/qquicksinglepointhandler_p.h src/quick/handlers/qquicktaphandler.cpp src/quick/items/context2d/qquickcontext2d.cpp Done-With: Ulf Hermann <ulf.hermann@qt.io> Change-Id: I109453131f9f0a05316ae37c7d6ed1edc8c0f9d4
| * | PinchHandler: fix pedantic warningsShawn Rutledge2019-01-282-20/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | - qreal<->float conversions are explicit - use qFuzzyCompare rather than == - remove padding between variables (but the class still needs padding) Change-Id: I9a9eb01f5a4108592b34e4b2f018c720ba19beb0 Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
| * | PinchHandler: Avoid unwanted translations when axes are disabledShawn Rutledge2019-01-281-6/+4
| | | | | | | | | | | | | | | | | | Fixes: QTBUG-72822 Change-Id: I2773ba14fcb24a47fe2ec04860b4aa305a051453 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
| * | Add handlers declared as Flickable children to its contentItemShawn Rutledge2019-01-221-1/+3
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| * Merge 5.12 into 5.12.1Kari Oikarinen2019-01-085-4/+8
| |\ | | | | | | | | | Change-Id: Ic746fbce93430867e2eda4bc7155d34e20a4aa2b
| * | TapHandler: clean up when wantsEventPoint returns falseShawn Rutledge2018-12-132-2/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We already emitted grabCanceled() to inform QML callbacks, but we didn't call reset(). It seems more proper to do everything that would normally be done when grab is canceled. TapHandler should not give up its passive grab yet though, because that prevents delivery to any parent Flickable that might be filtering events. A parent Flickable should be able to start flicking after the drag threshold is exceeded (it happens to be exactly when TapHandler gives up). Fixes: QTBUG-71466 Fixes: QTBUG-71970 Change-Id: Ibba1b0de92cfd88547eeb44edb095d019de76a94 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
| * | PointHandler: distribute simultaneous touch presses properlyShawn Rutledge2018-12-131-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If multiple touchpoints are pressed simultaneously, each point can be grabbed by one PointHandler instance. Each PointHandler instance cannot grab more than one point, nor grab a point that is already chosen by another PointHandler. This was always the intention, but got broken (perhaps by 3523b676382db4aa39adeb9126d8bb2185e84403), and there was no test coverage of this case until now. Fixes: QTBUG-71431 Change-Id: I6d7614eb4767c677d929291f917cf62d9c03bd93 Reviewed-by: Andre de la Rocha <andre.rocha@qt.io>
* | | Merge remote-tracking branch 'origin/5.12' into devQt Forward Merge Bot2019-01-103-4/+2
|\ \ \ | | |/ | |/| | | | | | | | | | | | | Conflicts: .qmake.conf Change-Id: I6b2539bf17d3e9bc66d96b53c1bce95680113ed8
| * | Doc: Fix link issuesNico Vertriest2019-01-033-4/+2
| | | | | | | | | | | | | | | Change-Id: I738b9da5335afb048d2eda2edf2be5095a91d7e5 Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* | | Merge remote-tracking branch 'origin/5.12' into devQt Forward Merge Bot2018-12-231-0/+2
|\| | | | | | | | | | | Change-Id: I9c3d282c11a556e616c5e1ba1b51e88b741327f6
| * | When there are no points to grab, then we should return falseAndy Shaw2018-12-191-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If there are no points to grab then it should not indicate that it was able to grab points. Otherwise it can cause a handler to be active when it has not valid points to work with. This can happen if you do a pinch gesture on a DragHandler as the points are not valid by default then. Fixes: QTBUG-71972 Change-Id: Ib1c48e5a3777f4118944accfa2bc92edf0209884 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* | | Merge remote-tracking branch 'origin/5.12' into devQt Forward Merge Bot2018-12-121-0/+4
|\| | | | | | | | | | | | | | | | | | | | Conflicts: tests/auto/qml/debugger/qqmldebugjs/tst_qqmldebugjs.cpp Change-Id: Ic1dace832ad4b29023d24808b8617b5dcc915eb5
| * | TapHandler: ignore scroll events and native gesturesShawn Rutledge2018-12-101-0/+4
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | During a 2-finger press (to emulate right click on a trackpad), the OS may also generate a QWheelEvent with ScrollBegin phase just in case scrolling starts. This must not prematurely deactivate the TapHandler. Also if a gesture or wheel event begins as the very first event after an application starts, ensure that subsequent mouse events are not mis-delivered as wheel or gesture events. Fixes: QTBUG-71955 Change-Id: Ic12e116483ab9ad37c4ac3b1d10ccb62e1349e0a Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* / Refactor QQuickSinglePointHandler into public and private classesShawn Rutledge2018-12-054-27/+131
|/ | | | | Change-Id: Idf861ce4286e24cecd81f802032243b467950c5e Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* Doc: Fix QDoc warningsPaul Wicking2018-10-011-1/+1
| | | | | Change-Id: I19545953bde10d4ccc2f37843dcda2569dc77df4 Reviewed-by: Martin Smith <martin.smith@qt.io>
* Doc: fix grabPermissions and other enumeration propertiesShawn Rutledge2018-09-143-8/+27
| | | | | | | | | | | | * grabPermissions is a flags property, not bool. * Add a list of the possible grabPermissions values. * Fix two other places where \qmlproperty enum was used instead of enumeration. * acceptedButtons, acceptedDevices, acceptedModifiers and acceptedPointerTypes are flags properties, not plain int. Change-Id: I6f49dcc1e1762e913e4989b208380d64899630a6 Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* PinchHandler: update centroid property when handling native gestureShawn Rutledge2018-09-131-0/+1
| | | | | | | | | | The gesture occurs at a location. It so happens that when the gesture begins, macOS holds the position fixed; but on other OSes, maybe the position could move around, if dragging during pinch is allowed. Change-Id: Ie3184b5002548cb8fff3b3b6c471966ae4b8f6d9 Fixes: QTBUG-70075 Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* Fix potential nullptr-derefErik Verbruggen2018-09-131-2/+2
| | | | | | | Task-number: QTBUG-70142 Change-Id: I97fe80e94a553d81695f4516e84ff8ac0d086347 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Doc: Show that DragHandler is now a multi-point handlerShawn Rutledge2018-09-111-1/+1
| | | | | | | | | Inheritance changed, and that means it has a centroid property. Amends ca7cdd71ee33f0d77eb6bf1367d2532e26155cb2 Task-number: QTBUG-68106 Change-Id: Ie68eb1376868b143dd56564a3abc896dd7e745c6 Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* Doc: Fix the QML type of MultiPointHandler.centroidShawn Rutledge2018-09-112-2/+2
| | | | | | | | We use QML types not C++ types in QML docs. This fixes links so that you can see the centroid's properties. Change-Id: I3efe04dbfefba965176030adc3e65672519b81dc Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* Remove dubious API features and clutter from Pointer Handler headersShawn Rutledge2018-08-314-5/+0
| | | | | Change-Id: Ica67409f3138828d8a33fef2d67ad799a5a063f5 Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* Remove the PinchHandler.pinchOrigin property for nowShawn Rutledge2018-08-312-38/+1
| | | | | | | | | We didn't get around to implementing the appropriate behaviors. We could add it back later if we figure out how. Task-number: QTBUG-70292 Change-Id: Idca62b249f555d5e44bb97430ae0222bf314a66b Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>