From 5506dc44afbef14f27cb180afe9c388728be7e82 Mon Sep 17 00:00:00 2001 From: Richard Moe Gustavsen Date: Thu, 15 Oct 2020 19:39:53 +0200 Subject: nativestyle, ScrollView: don't resize scroll bars according to padding Depending on if you see the scroll bars as a part of the contents, the background, or neither, they should respect either padding, insets, or none of them. The styles that use transient scrollbars see them partly as a part of the contents (judging from their implementation), which means that their width and height will respect padding, but their position will not (they will always be glued to the right or the bottom side of the control). Letting width and height be affected by padding doesn't work so well with non-transient scroll bars. In that case the scroll bars should normally be "connected" at the bottom-right edge. So change the code so that the scrollbars ignore padding, and instead use the full width and height of the control. Change-Id: Ifa5a7708a51b3773a63ebdd50781eb3845be4744 Reviewed-by: Mitch Curtis --- src/imports/controls/macos/ScrollView.qml | 8 ++++---- src/imports/controls/windows/ScrollView.qml | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/imports/controls/macos/ScrollView.qml b/src/imports/controls/macos/ScrollView.qml index 9b695161..954c5d8a 100644 --- a/src/imports/controls/macos/ScrollView.qml +++ b/src/imports/controls/macos/ScrollView.qml @@ -53,8 +53,8 @@ T.ScrollView { ScrollBar.vertical: ScrollBar { parent: control x: control.mirrored ? 0 : control.width - width - y: control.topPadding - height: control.availableHeight + y: 0 + height: control.height - (control.ScrollBar.horizontal.visible ? control.ScrollBar.horizontal.height : 0) active: control.ScrollBar.horizontal.active NativeStyle.ScrollViewCorner { @@ -67,9 +67,9 @@ T.ScrollView { ScrollBar.horizontal: ScrollBar { parent: control - x: control.leftPadding + x: 0 y: control.height - height - width: control.availableWidth + width: control.width - (control.ScrollBar.vertical.visible ? control.ScrollBar.vertical.width : 0) active: control.ScrollBar.vertical.active } } diff --git a/src/imports/controls/windows/ScrollView.qml b/src/imports/controls/windows/ScrollView.qml index fe56713c..0e5ffff4 100644 --- a/src/imports/controls/windows/ScrollView.qml +++ b/src/imports/controls/windows/ScrollView.qml @@ -52,16 +52,16 @@ T.ScrollView { ScrollBar.vertical: ScrollBar { parent: control x: control.mirrored ? 0 : control.width - width - y: control.topPadding - height: control.availableHeight + y: 0 + height: control.height - (control.ScrollBar.horizontal.visible ? control.ScrollBar.horizontal.height : 0) active: control.ScrollBar.horizontal.active } ScrollBar.horizontal: ScrollBar { parent: control - x: control.leftPadding + x: 0 y: control.height - height - width: control.availableWidth + width: control.width - (control.ScrollBar.vertical.visible ? control.ScrollBar.vertical.width : 0) active: control.ScrollBar.vertical.active } } -- cgit v1.2.3