diff options
author | Nikita Krupenko <krnekit@gmail.com> | 2016-01-31 23:38:55 +0200 |
---|---|---|
committer | Nikita Krupenko <krnekit@gmail.com> | 2016-08-18 13:49:12 +0000 |
commit | 69af774a54198a83f774c89b5d5d7135b8fb1f7a (patch) | |
tree | 3e58d03b48b70499de0b741b2141667141468589 /src/controls | |
parent | c0f58d5283ce981b8cfbc43f602a3b6553e26ce2 (diff) | |
download | qtquickcontrols-69af774a54198a83f774c89b5d5d7135b8fb1f7a.tar.gz |
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 <mitch.curtis@qt.io>
Diffstat (limited to 'src/controls')
-rw-r--r-- | src/controls/Private/ScrollViewHelper.qml | 10 |
1 files changed, 10 insertions, 0 deletions
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 |