aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Moe Gustavsen <richard.gustavsen@qt.io>2020-10-02 10:39:21 +0200
committerRichard Moe Gustavsen <richard.gustavsen@qt.io>2020-10-09 11:06:06 +0200
commitd3a626fbc543c6edb68b5fa206a26840c103f7c0 (patch)
tree9af9556cf579ae2c2a1b110324a8279de375be5f
parentc752fdd9ab4cb5c5e9a980ffbc858c64251d5236 (diff)
Native style: ensure ScrollView contents doesn't go under the scrollbars
On macOS the scrollbars are not transient. The contentItem of a ScrollView should therefore be aligned to the side of the scrollbars, rather than to the side of the ScrollView. Change-Id: Ie58753d61c04c979270995deb6e3b2650fa643db Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
-rw-r--r--src/imports/controls/macos/ScrollView.qml3
-rw-r--r--src/imports/controls/windows/ScrollView.qml3
-rw-r--r--tests/manual/nativestyle/ControlContainer.qml2
-rw-r--r--tests/manual/nativestyle/TextAreas.qml2
-rw-r--r--tests/manual/nativestyle/main.qml4
5 files changed, 9 insertions, 5 deletions
diff --git a/src/imports/controls/macos/ScrollView.qml b/src/imports/controls/macos/ScrollView.qml
index 7940bb95..aced3809 100644
--- a/src/imports/controls/macos/ScrollView.qml
+++ b/src/imports/controls/macos/ScrollView.qml
@@ -51,6 +51,9 @@ T.ScrollView {
// (doesn't float on top), and in that case, the contents will show through them.
contentItem.clip: clip && (ScrollBar.vertical.visible || ScrollBar.horizontal.visible)
+ rightPadding: ScrollBar.vertical.visible ? ScrollBar.vertical.width : 0
+ bottomPadding: ScrollBar.horizontal.visible ? ScrollBar.horizontal.height : 0
+
ScrollBar.vertical: ScrollBar {
parent: control
x: control.mirrored ? 0 : control.width - width
diff --git a/src/imports/controls/windows/ScrollView.qml b/src/imports/controls/windows/ScrollView.qml
index a6bba9de..fe56713c 100644
--- a/src/imports/controls/windows/ScrollView.qml
+++ b/src/imports/controls/windows/ScrollView.qml
@@ -46,6 +46,9 @@ T.ScrollView {
implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
contentHeight + topPadding + bottomPadding)
+ rightPadding: ScrollBar.vertical.visible ? ScrollBar.vertical.width : 0
+ bottomPadding: ScrollBar.horizontal.visible ? ScrollBar.horizontal.height : 0
+
ScrollBar.vertical: ScrollBar {
parent: control
x: control.mirrored ? 0 : control.width - width
diff --git a/tests/manual/nativestyle/ControlContainer.qml b/tests/manual/nativestyle/ControlContainer.qml
index f528e994..5ac9f6bb 100644
--- a/tests/manual/nativestyle/ControlContainer.qml
+++ b/tests/manual/nativestyle/ControlContainer.qml
@@ -41,7 +41,7 @@ import QtQuick.Layouts
Item {
anchors.left: parent.left
anchors.right: parent.right
- anchors.rightMargin: 20 // make room for scrollbar
+ anchors.rightMargin: 7
implicitHeight: groupBox.height
property alias title: groupBox.title
diff --git a/tests/manual/nativestyle/TextAreas.qml b/tests/manual/nativestyle/TextAreas.qml
index f411c3bd..e3911992 100644
--- a/tests/manual/nativestyle/TextAreas.qml
+++ b/tests/manual/nativestyle/TextAreas.qml
@@ -78,7 +78,6 @@ ControlContainer {
+ "mollit anim id est laborum."
wrapMode: TextEdit.WordWrap
selectByMouse: true
- rightPadding: scrollView.ScrollBar.vertical.width
}
}
}
@@ -115,7 +114,6 @@ ControlContainer {
+ "mollit anim id est laborum."
wrapMode: TextEdit.WordWrap
selectByMouse: true
- rightPadding: scrollView2.ScrollBar.vertical.width
}
}
}
diff --git a/tests/manual/nativestyle/main.qml b/tests/manual/nativestyle/main.qml
index ef7c89a2..5e75e7a3 100644
--- a/tests/manual/nativestyle/main.qml
+++ b/tests/manual/nativestyle/main.qml
@@ -70,7 +70,7 @@ ApplicationWindow {
anchors.margins: 20
ScrollView {
- contentWidth: width
+ contentWidth: width - ScrollBar.vertical.width
clip: true
Column {
@@ -96,7 +96,7 @@ ApplicationWindow {
}
ScrollView {
- contentWidth: width
+ contentWidth: width - ScrollBar.vertical.width
clip: true
Column {