It is not clear how to style the QML ScrollView.
I want to have the below style for the ScrollView but getting error style
as invalid property.
import QtQuick 2.0
import QtQuick.Controls 2.14
import QtQuick.Controls.Styles 1.4
ScrollView {
style: ScrollViewStyle {
handle: Rectangle {
implicitWidth: 50
implicitHeight: 30
color: "red"
}
scrollBarBackground: Rectangle {
implicitWidth: 50
implicitHeight: 30
color: "black"
}
decrementControl: Rectangle {
implicitWidth: 50
implicitHeight: 30
color: "green"
}
incrementControl: Rectangle {
implicitWidth: 50
implicitHeight: 30
color: "blue"
}
}
//...
}
Update:
import QtQuick 2.0
import QtQuick.Controls 2.14
ScrollView {
id: myScrollView
width: 700
height: parent.height
clip: true
ScrollBar.vertical: ScrollBar {
id: scrollBar
parent: myScrollView.parent
policy: ScrollBar.AlwaysOn
anchors.top: myScrollView.top
anchors.left: myScrollView.right
anchors.bottom: myScrollView.bottom
height: myScrollView.availableHeight
contentItem: Rectangle {
implicitWidth: 16
implicitHeight: 10
anchors.leftMargin: 10
radius: 16
color: "blue"
}
}
ListView {
id: myListView
anchors.fill: parent
.... Rest of the code ....
With above code I could get the style for the vertical scrall bar but with this code I see two scrolls bars. One with light gray color with very small size and one with blue color as per the above style.
Also the height of the blue scroll bar is not as per the style.