QML ScrollViewStyle 宽度? [英] QML ScrollViewStyle width?

查看:99
本文介绍了QML ScrollViewStyle 宽度?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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.

推荐答案

要使滚动条变宽,您可以使用自定义组件更改 ScrollViewStyle 中的以下四个属性:handlescrollBarBackgrounddecrementControlincrementControl(如果不全部更改可能看起来很奇怪).例如,

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

它看起来像这样:

这篇关于QML ScrollViewStyle 宽度?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆