QML ScrollViewStyle 宽度?

Kyl*_*and 0 qt scroll scrollview qml

我想让 ScrollView 的滚动条比默认值更宽,但我看不到任何width属性,即使是ScrollViewStyle元素frame组件的一部分。

mcc*_*chu 6

为了使滚动条较宽,可以在更改以下四个属性ScrollViewStyle与您的自定义组件:handlescrollBarBackgrounddecrementControl,和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"
        }
    }
    //...
}
Run Code Online (Sandbox Code Playgroud)

它看起来像这样:

自定义滚动条