From 69af774a54198a83f774c89b5d5d7135b8fb1f7a Mon Sep 17 00:00:00 2001 From: Nikita Krupenko Date: Sun, 31 Jan 2016 23:38:55 +0200 Subject: Update scroll indicator position on content size change If scroll indicator is at the beginning and data prepended to contentItem, scroll indicator should change position to previous content beginning. This is especially important with so-called "infinite scrolling", when scrolling goes upwards and new content added at the top of the view. Task-number: QTBUG-50795 Change-Id: I250d6535b1146a54c6a70062b659cc49ed43709f Reviewed-by: Mitch Curtis --- src/controls/Private/ScrollViewHelper.qml | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src') diff --git a/src/controls/Private/ScrollViewHelper.qml b/src/controls/Private/ScrollViewHelper.qml index b4a589bf..bc3d9eb8 100644 --- a/src/controls/Private/ScrollViewHelper.qml +++ b/src/controls/Private/ScrollViewHelper.qml @@ -131,6 +131,11 @@ Item { anchors.right: cornerFill.left anchors.leftMargin: leftMargin anchors.bottomMargin: bottomMargin + onScrollAmountChanged: { + if (flickableItem && (flickableItem.atXBeginning || flickableItem.atXEnd)) { + value = flickableItem.contentX - flickableItem.originX + } + } onValueChanged: { if (!blockUpdates) { flickableItem.contentX = value + flickableItem.originX @@ -180,6 +185,11 @@ Item { anchors.top: parent.top anchors.topMargin: __scrollBarTopMargin + topMargin anchors.rightMargin: rightMargin + onScrollAmountChanged: { + if (flickableItem && (flickableItem.atYBeginning || flickableItem.atYEnd)) { + value = flickableItem.contentY - flickableItem.originY + } + } onValueChanged: { if (flickableItem && !blockUpdates && enabled) { flickableItem.contentY = value + flickableItem.originY -- cgit v1.2.1