From c752fdd9ab4cb5c5e9a980ffbc858c64251d5236 Mon Sep 17 00:00:00 2001 From: Richard Moe Gustavsen Date: Fri, 2 Oct 2020 10:36:44 +0200 Subject: 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 --- src/imports/controls/macos/ScrollView.qml | 5 +++++ 1 file changed, 5 insertions(+) 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 -- cgit v1.2.3