通过qtquickcontrols2-configuration更改控件类型样式?

时间:2018-11-30 14:49:35

标签: qt qml qtquickcontrols2

我可以使用qtquickcontrols2.conf文件对ButtonsLabels之类的控件进行全局样式化吗?

例如,我可以做以下事情吗?

[Controls]
Style=Material

[Material]
Theme=Dark

[Material\Button]
Text=Red

[Material\Label]
Color=Red

以上不适用于我。我知道我可以使用样式单例方法,但这意味着我需要在制作的每个QML文档中使用样式变量。如果可能的话,最好像上面这样全局地更改它。

也:某些配置设置不起作用。例如,调色板更改不起作用,但字体更改起作用。知道为什么吗?

[Controls]
Style=Material

[Material]
Theme=Dark ; These changes work
Accent=Red
Palette.Base=Red  ; These changes are not applied/shown?
Palette.Text=Blue

; These changes are applied/shown
[Material\Font]
Family=Open Sans
PixelSize=20

; These changes are not applied/shown?
[Material\Palette]
Base=#000000
Text=#ffffff

0 个答案:

没有答案