QML ScrollViewStyle width?

倾然丶 夕夏残阳落幕 提交于 2019-12-13 07:21:14

问题


I'd like to make a ScrollView's scroll bar wider than the default value, but I don't see any width properties, even as part of the ScrollViewStyle element's frame component.


回答1:


To make the scroll bar wider, you can change the following four properties in ScrollViewStyle with your custom components: handle, scrollBarBackground, decrementControl, and incrementControl (it may look weird if you do not change all of them). For example,

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"
        }
    }
    //...
}

and it looks like this:



来源:https://stackoverflow.com/questions/36511834/qml-scrollviewstyle-width

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!