简体   繁体   English

样式化Qml桌面组件

[英]Styling Qml desktop components

Currently I'm working on a desktop application that supports touchscreen display. 目前,我正在开发支持触摸屏显示的桌面应用程序。 I use QML on Qt 4.8 and OpenSUSE 13.1 (I can't upgrade either Qt or the OS due to dependencies reason) 我在Qt 4.8和OpenSUSE 13.1上使用QML(由于依赖性原因,我无法升级Qt或操作系统)

Because of the lack of main components, I use qml desktop component . 由于缺少主要组件,因此我使用qml桌面组件 However, I don't find a way to style those conveniently, like use CSS. 但是,我找不到一种方便的样式化样式,例如使用CSS。 Something like change the color of the button, change the border... seem complicated 诸如更改按钮的颜色,更改边框之类的东西似乎很复杂

I've read Qml styling guide , Qml integrating guide but can't find a satisfied answer. 我已经阅读了Qml样式指南Qml集成指南,但是找不到满意的答案。

Any ideas are appreciated :) 任何想法表示赞赏:)

sry for my english, You could make specific qml object for each type, like this 对不起,我可以为每种类型制作特定的qml对象,例如:

TimesItalic.qml TimesItalic.qml

Text{
     FontLoader {
         id:timesNewRomanItalic;
         source:"qrc:/Assets/Fonts/times_italic"
         onStatusChanged: console.log("Font loaded " + name)
     }

     font.family: timesNewRomanItalic.name
     color : "#FFFFFF"
 }

and call this qml object each time you need it 并在每次需要时调用此qml对象

TimesItalic{
    id:myText
    anchors.fill:parent
    text: "Times new roman italic"
}

(this example is not optimised) (未优化此示例)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM