summaryrefslogtreecommitdiff
path: root/src/quick/handlers/qquickdraghandler.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* start making explicit exclusive or passive grabsShawn Rutledge2017-02-101-2/+3
| | | | | Change-Id: I4a6e3c72d69e893fec2e39f4faab24af6d00c7e0 Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* QQPSingleHandler: copy some values from QQuickEventPoint to propertiesShawn Rutledge2017-01-031-1/+1
| | | | | | | | | 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-291-0/+10
| | | | | | | | | | | | | | 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-291-10/+1
| | | | | | | | | | | | | | | | | 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>
* Don't assume that target is the parent itemJan Arve Saether2016-12-291-3/+0
| | | | | | | | | | | To summarize: A pointer handler always gets its pointer events from its parent item. It applies its effect (drag, pinch, ...) on the item referenced to by the target property. By default, target refers to the parent, but that is not always the case. In addition to this we also have to handle the case when the target is null Change-Id: If62108abf0aeb713906bf88472ad9a32a74efff6 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Fixed bug in DragHandler when dragging in scaled coordinate systemJan Arve Saether2016-12-271-4/+7
| | | | | | | | | | | | | Calculate the new position in the target items' parent coordinate system in order to not be affected by any transformations applied on the target item. And after all, the item's position is specified in parent coordinates. Also check target() and target()->parentItem() rather than assuming that they are non-null. Change-Id: Ib00c72cce7b324b508884287e4070bedaf02b95e Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* DragHandler: override wantsEventPoint to retain interest out of boundsShawn Rutledge2016-12-091-0/+7
| | | | | | | | | | In any use case where the movement is constrained, as in a slider or scrollbar, it's possible to keep dragging even when the eventpoint is out of bounds. QQuickPointerSingleHandler::wantsEventPoint() returns false when the point is out of bounds, so we have to override it. Change-Id: Id80f614d6c38f28e6520ee8eacf7649f7317a5ef Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* DragHandler: grab when dragging over the thresholdShawn Rutledge2016-10-171-0/+1
| | | | | Change-Id: I529987797a3fdce967cdac21f29d3a067e0cbd4b Reviewed-by: Jan Arve Sæther <jan-arve.saether@theqtcompany.com>
* Introduce DragHandlerShawn Rutledge2016-08-261-0/+160
A handler for dragging Items around by touch or mouse. Change-Id: Id83fea568095eb6374f3f1abc6f550d81f3731df Reviewed-by: Jan Arve Sæther <jan-arve.saether@theqtcompany.com>