diff options
| author | Vladimir Belyavsky <belyavskyv@gmail.com> | 2026-09-25 17:49:43 +0300 |
|---|---|---|
| committer | Vladimir Belyavsky <belyavskyv@gmail.com> | 2026-09-30 16:03:57 +0000 |
| commit | 4e6853b0e78beb2aeb8150b64dc13784e34016c2 (patch) | |
| tree | 82614d524eff7231fccf00bca2ed6e16a2fe8a7e /src/quicktemplates/qquickscrollbar_p_p.h | |
| parent | 549ecd1eee8d9c48dfccf6f5404ec1c4b0175f08 (diff) | |
ScrollBar: don't jump the content when the content size is re-estimated
A view with delegates of varying sizes keeps correcting its
contentHeight estimate while the handle is being dragged, which changes
the mapping from the ScrollBar's position to contentY. offset, the
distance between the handle and the pointer, was taken once in
handlePress() and never recalculated, so the content jumped against the
direction of the drag after every correction.
Recalculate offset whenever something other than the drag moves the
handle or changes the size while it is pressed. An attached Flickable
writes the drag's own position back through visibleArea, so such a write
is recognised by value: a position equal to the current one has moved
the handle nowhere.
The handle may still move and resize as the estimate is refined, which
is expected; only the content is kept following the pointer.
[ChangeLog][Controls][ScrollBar] Dragging the handle of a ScrollBar that
is attached to a view whose delegates vary in size no longer makes the
content jump as the view refines its content size estimate.
Task-number: QTBUG-130890
Pick-to: 6.12
Change-Id: I62447df8c43051896dc71f61263295f8a5acb7ac
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'src/quicktemplates/qquickscrollbar_p_p.h')
| -rw-r--r-- | src/quicktemplates/qquickscrollbar_p_p.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/quicktemplates/qquickscrollbar_p_p.h b/src/quicktemplates/qquickscrollbar_p_p.h index 17e35f3737..5c2f63050f 100644 --- a/src/quicktemplates/qquickscrollbar_p_p.h +++ b/src/quicktemplates/qquickscrollbar_p_p.h @@ -47,6 +47,9 @@ public: qreal logicalPosition(qreal position) const; void setPosition(qreal position, bool notifyVisualChange = true); + void setPositionFromDrag(qreal position, const QPointF &point); + void updatePosition(qreal position, bool notifyVisualChange); + void reanchorDragOffset(qreal position); qreal snapPosition(qreal position) const; qreal positionAt(const QPointF &point) const; void setInteractive(bool interactive); @@ -71,6 +74,7 @@ public: qreal stepSize = 0; qreal offset = 0; qreal minimumSize = 0; + QPointF dragPoint; bool active = false; bool pressed = false; bool moving = false; |
