summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/controls/ScrollView.qml8
-rw-r--r--src/private/ScrollViewHelper.qml12
-rw-r--r--tests/manual/scrollview/main.qml20
3 files changed, 33 insertions, 7 deletions
diff --git a/src/controls/ScrollView.qml b/src/controls/ScrollView.qml
index 31f69b8f..3262648e 100644
--- a/src/controls/ScrollView.qml
+++ b/src/controls/ScrollView.qml
@@ -236,11 +236,15 @@ FocusScope {
property bool horizontalRecursionGuard: false
property bool verticalRecursionGuard: false
- horizontalMaximumValue: flickableItem ? flickableItem.contentWidth - viewport.width : 0
- verticalMaximumValue: flickableItem ? flickableItem.contentHeight - viewport.height + __viewTopMargin : 0
+ horizontalMinimumValue: flickableItem ? flickableItem.originX : 0
+ horizontalMaximumValue: flickableItem ? flickableItem.originX + flickableItem.contentWidth - viewport.width : 0
+
+ verticalMinimumValue: flickableItem ? flickableItem.originY : 0
+ verticalMaximumValue: flickableItem ? flickableItem.originY + flickableItem.contentHeight - viewport.height + __viewTopMargin : 0
Connections {
target: flickableItem
+
onContentYChanged: {
wheelArea.verticalRecursionGuard = true
wheelArea.verticalValue = flickableItem.contentY
diff --git a/src/private/ScrollViewHelper.qml b/src/private/ScrollViewHelper.qml
index cf5c514f..9e8e78d6 100644
--- a/src/private/ScrollViewHelper.qml
+++ b/src/private/ScrollViewHelper.qml
@@ -57,6 +57,8 @@ Item {
property int availableWidth
property int contentHeight
property int contentWidth
+ property real originX
+ property real originY
property int leftMargin: outerFrame ? root.__style.padding.left : 0
property int rightMargin: outerFrame ? root.__style.padding.right : 0
@@ -74,6 +76,8 @@ Item {
wheelarea.availableHeight = viewport.height
wheelarea.contentWidth = flickableItem !== null ? flickableItem.contentWidth : 0
wheelarea.contentHeight = flickableItem !== null ? flickableItem.contentHeight : 0
+ wheelarea.originX = flickableItem !== null ? flickableItem.originX : 0
+ wheelarea.originY = flickableItem !== null ? flickableItem.originY : 0
recursionGuard = false
}
}
@@ -123,8 +127,8 @@ Item {
visible: contentWidth > availableWidth
height: visible ? implicitHeight : 0
z: 1
- maximumValue: contentWidth > availableWidth ? contentWidth - availableWidth : 0
- minimumValue: 0
+ maximumValue: contentWidth > availableWidth ? originX + contentWidth - availableWidth : 0
+ minimumValue: originX
anchors.bottom: parent.bottom
anchors.left: parent.left
anchors.right: cornerFill.left
@@ -158,8 +162,8 @@ Item {
width: visible ? implicitWidth : 0
z: 1
anchors.bottom: cornerFill.top
- maximumValue: contentHeight > availableHeight ? contentHeight - availableHeight + __viewTopMargin : 0
- minimumValue: 0
+ maximumValue: contentHeight > availableHeight ? originY + contentHeight - availableHeight + __viewTopMargin : 0
+ minimumValue: originY
anchors.right: parent.right
anchors.top: parent.top
anchors.topMargin: __scrollBarTopMargin + topMargin
diff --git a/tests/manual/scrollview/main.qml b/tests/manual/scrollview/main.qml
index 71accd8e..a245ca88 100644
--- a/tests/manual/scrollview/main.qml
+++ b/tests/manual/scrollview/main.qml
@@ -78,6 +78,12 @@ ApplicationWindow {
value: 1000
implicitWidth: 80
}
+ CheckBox {
+ id: largeCheck
+ text: "Large"
+ checked: false
+ implicitWidth: 80
+ }
Item { Layout.fillWidth: true }
}
}
@@ -139,6 +145,7 @@ ApplicationWindow {
frameVisible: frameCheck.checked
text: loremIpsum + loremIpsum + loremIpsum + loremIpsum
anchors.fill: parent
+ font.pixelSize: largeCheck.checked ? 26 : 13
}
}
Tab {
@@ -152,7 +159,7 @@ ApplicationWindow {
model: 30
delegate: Rectangle {
width: parent.width
- height: 30
+ height: largeCheck.checked ? 60 : 30
Text {
anchors.fill: parent
anchors.margins: 4
@@ -177,6 +184,17 @@ ApplicationWindow {
model: 10
frameVisible: frameCheck.checked
+ rowDelegate: Rectangle {
+ width: parent.width
+ height: largeCheck.checked ? 60 : 30
+ Rectangle {
+ anchors.bottom: parent.bottom
+ width: parent.width
+ height: 1
+ color: "darkgray"
+ }
+ }
+
TableViewColumn {title: "first"
width: view.viewport.width
}