summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKai Uwe Broulik <kde@privat.broulik.de>2017-01-05 12:47:31 +0100
committerKai Uwe Broulik <kde@privat.broulik.de>2017-01-16 12:49:33 +0000
commit8a223fc04e003d93c63dc3c1786da115dd70c7bd (patch)
tree0f4444390cfb48c3673943380e065bc9bc6e9082
parent08d0ec79897ea2b9ba830f66f8b2ecfbce8723e1 (diff)
downloadqtquickcontrols-8a223fc04e003d93c63dc3c1786da115dd70c7bd.tar.gz
ScrollViewStyle: Limit maximum scroll bar size
Avoids the scroll bar overflowing its container. This can happen when e.g. contentWidth/height becomes zero. Change-Id: Ib01e65535ef1f11e32aaca8b19ec93f5ebf99736 Reviewed-by: Marco Martin <notmart@gmail.com> Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
-rw-r--r--src/controls/Styles/Base/ScrollViewStyle.qml4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/controls/Styles/Base/ScrollViewStyle.qml b/src/controls/Styles/Base/ScrollViewStyle.qml
index da1930ea..3df278c6 100644
--- a/src/controls/Styles/Base/ScrollViewStyle.qml
+++ b/src/controls/Styles/Base/ScrollViewStyle.qml
@@ -370,8 +370,8 @@ Style {
property var flickableItem: control.flickableItem
property int extent: Math.max(minimumHandleLength, __styleData.horizontal ?
- (flickableItem ? flickableItem.width/flickableItem.contentWidth : 0 ) * bg.width :
- (flickableItem ? flickableItem.height/flickableItem.contentHeight : 0) * bg.height)
+ Math.min(1, (flickableItem ? flickableItem.width/flickableItem.contentWidth : 0)) * bg.width :
+ Math.min(1, (flickableItem ? flickableItem.height/flickableItem.contentHeight : 0)) * bg.height)
readonly property real range: __control.maximumValue - __control.minimumValue
readonly property real begin: __control.value - __control.minimumValue