aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Moe Gustavsen <richard.gustavsen@qt.io>2020-10-02 10:36:44 +0200
committerRichard Moe Gustavsen <richard.gustavsen@qt.io>2020-10-09 11:06:02 +0200
commitc752fdd9ab4cb5c5e9a980ffbc858c64251d5236 (patch)
tree4fc4e2422842187f54bd228f7f4e405b5c48924c
parent3ef7a9c34782fbc4e17a4d6448ee8ff1daea32ce (diff)
Native style, macOS: clip content view when ScrollView is clipped
On macOS, if a ScrollView has a clip set, we should clip the contentItem as well. This because the scrollbars are semi-transparent and non-transient (doesn't float on top), and in that case, the contents will show through them. So we assume that if the user sets a clip on the ScrollView, he want's to make sure that the contents is not showing outside the area where the contents are supposed to be. Change-Id: I7fff89843c0db38ec1caa6d18464e964788743c1 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
-rw-r--r--src/imports/controls/macos/ScrollView.qml5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/imports/controls/macos/ScrollView.qml b/src/imports/controls/macos/ScrollView.qml
index a6bba9de..7940bb95 100644
--- a/src/imports/controls/macos/ScrollView.qml
+++ b/src/imports/controls/macos/ScrollView.qml
@@ -46,6 +46,11 @@ T.ScrollView {
implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
contentHeight + topPadding + bottomPadding)
+ // If ScrollView has clip set, we need to clip the contentItem as well.
+ // This because the scrollbars are semi-transparent and non-transient
+ // (doesn't float on top), and in that case, the contents will show through them.
+ contentItem.clip: clip && (ScrollBar.vertical.visible || ScrollBar.horizontal.visible)
+
ScrollBar.vertical: ScrollBar {
parent: control
x: control.mirrored ? 0 : control.width - width