简体   繁体   English

QML或C ++(级联)中的选项样式(Dropdown,RadioGroup等)

[英]Option style (Dropdown, RadioGroup, etc) in QML or C++ (Cascades)

I'm trying to set a custom style to a group of options belonging to a dropdown or a Radio Group. 我试图将自定义样式设置为属于下拉列表或Radio Group的一组选项。 I'm searching all over and it seems impossible. 我到处搜寻,似乎不可能。 At least I would like to decrease the size of the letters in the text of each option because is too big! 至少我想减小每个选项文本中字母的大小,因为太大了! and crashes my UI. 并崩溃了我的用户界面。

Here's and example of what I need: 这是我需要的示例:

RadioGroup {
 id: groupOrigin
 objectName: "groupOrigin"

 Option{
   text: "text to display" 
   //This text default style is what I'm trying to change. Please help!.
 }
}

thanks! 谢谢!

for Radio group you can achieve this using custom implementation. 对于Radio组,您可以使用自定义实现来实现。 Take a label and place it after the radio group did not provide text inside the options tag. 采取标签并将其放置在无线电组未在options标签内提供文本之后。 So whatever style you want to apply can be done using label. 因此,无论您要应用哪种样式,都可以使用label来完成。

On label you can set the font size, color and other style parameter you want to apply. 在标签上,您可以设置要应用的字体大小,颜色和其他样式参数。

Please check the source code below for this custom radio button. 请检查以下自定义单选按钮的源代码。 I did this in the QML you can achieve same in C++. 我在QML中做到了这一点,您可以在C ++中实现相同的目的。

// The Component title.
    Label {
        id: titleLabel
        text: ""
        textStyle {
            base: SystemDefaults.TextStyles.SmallText
            alignment: TextAlignment.Center
        }
        layoutProperties: StackLayoutProperties {
            horizontalAlignment: HorizontalAlignment.Fill
        }
    }

    // The radio group presenting the different curves.
    RadioGroup {
        id: radioGroup

        Option {
            text: "Height"
        }
    }

暂无
暂无

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

相关问题 Blackberry 10 Cascades qml(C ++和QT)中的布局存在问题 - Having an issue with the layouts in Blackberry 10 Cascades, qml (C++ & QT) 如何在C++、Qt、QML、Blackberry 10 Cascades Beta 3 SDK中制作图表/图形(如折线图、条形图、圆形图)等? - How to make charts/graphs (such as line graphs, bar graphs, circle graphs), etc. in C++, Qt, QML, Blackberry 10 Cascades Beta 3 SDK? 使XML数据在C ++的Blackberry 10 Cascades QML中的listItemComponents中显示 - Make XML data show in listItemComponents in Blackberry 10 Cascades QML from C++ 尝试将QGeoSearchReply的结果添加到Blackberry 10级联(C ++,QT和QML)中的maps :: DataProvider中 - Trying to add the result of a QGeoSearchReply to a maps::DataProvider in Blackberry 10 Cascades (C++, QT & QML) 我的Blackberry 10 Cascades(C ++,Qt和QML)示例应用程序在启动时崩溃,并出现以下错误 - My Blackberry 10 Cascades (C++, Qt & QML) sample app is crashing on startup with the following error 如何在Blackberry Cascades,QML和C ++,QT的列表视图中获取Web视图 - How do I get a web view in a list view in Blackberry Cascades, QML & C++, QT 在Blackberry Cascades 10(C ++,Qt,QML)中,如何调用填充了字段的电子邮件客户端? - In Blackberry Cascades 10 (C++, Qt, QML), how do I invoke an email client with the fields populated? 如何响应在Blackberry 10 Cascades中的qml,C ++ qt列表视图中单击列表项 - How to respond to clicking on list items in a list view in qml, C++ qt, in Blackberry 10 Cascades C++ 构建器中的 RadioGroup - RadioGroup in c++ builder 如何使用Cascades,Blackberry 10中的Qt / QML / C ++从另一个qml文件更改一个qml文件中的标签文本? - How do I change the label text in one qml file from another qml file using Qt/QML/C++ in Cascades, Blackberry 10?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM