我想调整Switch
的大小(如果我使用QtQuick 1.x
或2.x
,则无关紧要。)
然而,使用参数width
和height
并不起作用。
有什么想法吗?
答案 0 :(得分:1)
您可以customize the Switch to your needs提供自定义indicator
。
默认情况下,这似乎是Item
,其中有两个子项用于凹槽(children[0]
)和句柄(children[1]
)。由于在创建项目之前无法访问这些属性,因此可以使用绑定:
Switch {
id: swch
anchors.fill: parent
Binding {
target: swch.indicator
property: 'width'
value: swch.width
}
Binding {
target: (swch.indicator ? swch.indicator.children[0] : null)
property: 'width'
value: swch.width
}
}