小韩老师:去你安装目录找到,比如Qt5.9的C:\Qt\Qt5.9.0\5.9\Src\qtquickcontrols\src\controls\Styles\Base\ScrollViewStyle.qml
这个就是ScrollViewStyle的qml实现方式,
里边有滑动条
property Component handle: Item {.../}以及背景
property Component scrollBarBackground: Item {}一堆内容你稍微修改一下就可以实现你需要的方式,比如说那个当停靠时就透明度就是0,移开时透明度就是1
.......

感谢大神的回复,我前面也看了下文档,不知道哪有属性可以设置靠近改变透明度,新手请见谅

property Component scrollBarBackground: Item {
property bool sticky: false
property bool hovered: styleData.hovered
implicitWidth: Math.round(TextSingleton.implicitHeight)
implicitHeight: Math.round(TextSingleton.implicitHeight)
clip: true
opacity: transientScrollBars ? 0.5 : 1.0
visible: !Settings.hasTouchScreen && (!transientScrollBars || sticky)
Rectangle {
anchors.fill: parent
color: "#ddd"
border.color: "#aaa"
anchors.rightMargin: styleData.horizontal ? -2 : -1
anchors.leftMargin: styleData.horizontal ? -2 : 0
anchors.topMargin: styleData.horizontal ? 0 : -2
anchors.bottomMargin: styleData.horizontal ? -1 : -2
}
onHoveredChanged: if (hovered) sticky = true
onVisibleChanged: if (!visible) sticky = false
}