diff options
author | Shawn Rutledge <[email protected]> | 2021-04-28 09:34:24 +0200 |
---|---|---|
committer | Shawn Rutledge <[email protected]> | 2021-05-05 15:20:55 +0200 |
commit | f83efd3feb564cf8b929b9dfde6787853a561069 (patch) | |
tree | 3891b0db82c09dc8af57a4a9015cb393edf78365 /src/quick/util/qquickdeliveryagent_p.h | |
parent | f2aaa182528008bfa6b3859e98263fa9470b1594 (diff) |
Use QQDeliveryAgent::sceneTransform, if set, in QQuickItem::mapFromGlobal
During dragging of a QEventPoint, Flickable computes the drag delta as
pos - mapFromGlobal(point.globalPressPosition())
We cannot use only the global position delta, because the Flickable
might be transformed in 2D (by setting rotation on it or in a parent, as
in tst_qquickflickable::clickAndDragWhenTransformed) or in 3D (by mapping
it onto a Model object). So we really need QQuickItem::mapFromGlobal()
to actually work regardless how many of these transformations are in
place. This is just the beginning: we have a lot of these mapFrom/To
functions; but it's enough for the Flickable in the quick3d/dynamictexture
example to work better. Without this fix, if you tried to drag a yellow
note on the door panel, at the very first drag ListView saw a large
delta and considered its drag threshold exceeded immediately, whereas
the DragHandler on the note saw a very small delta; so ListView grabbed
and DragHandler did not steal it: it relies on having "first dibs".
When the drag threshold is exceeded, Flickable merely plans to grab on
the next event rather than grabbing immediately, and therefore a child
has a chance to grab first. Therefore it's normally OK for DragHandler
to simply become the first exclusive grabber when the drag threshold is
exceeded, and not steal the grab from another item (although
grabPermissions can be changed to allow stealing if necessary).
However this means that we continue to enforce the drag threshold in
local (transformed) coordinates: if Flickable should wait until the
user drags 10 pixels, but it's scaled to half-size, it will start
dragging after only 5 pixels of movement, for example.
Pick-to: 6.1
Task-number: QTBUG-92944
Change-Id: Id01cc833ca80850ca18a965adf47f435e43e20ed
Reviewed-by: Andy Nichols <[email protected]>
Diffstat (limited to 'src/quick/util/qquickdeliveryagent_p.h')
-rw-r--r-- | src/quick/util/qquickdeliveryagent_p.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/quick/util/qquickdeliveryagent_p.h b/src/quick/util/qquickdeliveryagent_p.h index 9b73d9b9b9..df8c97b368 100644 --- a/src/quick/util/qquickdeliveryagent_p.h +++ b/src/quick/util/qquickdeliveryagent_p.h @@ -81,6 +81,7 @@ public: QQuickItem *rootItem() const; + Transform *sceneTransform() const; void setSceneTransform(Transform *transform); bool event(QEvent *ev) override; |