QML ScrollViewStyle 宽度?
QML ScrollViewStyle width?
我想让 ScrollView 的滚动条比默认值更宽,但我没有看到任何 width
属性,即使是 ScrollViewStyle
元素的 frame
组件。
要使滚动条变宽,您可以使用自定义组件更改 ScrollViewStyle
中的以下四个属性:handle
、scrollBarBackground
、decrementControl
和 incrementControl
(如果不全部更改,可能看起来很奇怪)。例如,
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"
}
}
//...
}
看起来像这样:
我想让 ScrollView 的滚动条比默认值更宽,但我没有看到任何 width
属性,即使是 ScrollViewStyle
元素的 frame
组件。
要使滚动条变宽,您可以使用自定义组件更改 ScrollViewStyle
中的以下四个属性:handle
、scrollBarBackground
、decrementControl
和 incrementControl
(如果不全部更改,可能看起来很奇怪)。例如,
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"
}
}
//...
}
看起来像这样: