ColorGroup QML Type
按角色划分的颜色集。更多
属性
- accent : color
(since 6.6) - alternateBase : color
- base : color
- brightText : color
- button : color
- buttonText : color
- dark : color
- highlight : color
- highlightedText : color
- light : color
- link : color
- linkVisited : color
- mid : color
- midlight : color
- placeholderText : color
(since 6.2) - shadow : color
- text : color
- toolTipBase : color
- toolTipText : color
- window : color
- windowText : color
信号
- changed()
详细说明
ColorGroup 类型用于定义一组具有特定作用的颜色。虽然 ColorGroup 没有视觉外观,但它定义了用于自定义渲染项的颜色。
颜色的默认值等于默认构建的活动组颜色QPalette 。
以下代码可用于创建一个指定了某些颜色的颜色组:
ColorGroup { alternateBase: "red" base: "green" }
Palette 类型为每个 QML 项目状态公开了颜色组。
属性文档
accent : color [since 6.6]
通常与base 、window 和button 颜色形成对比或相互衬托的颜色。它通常代表用户对桌面个性化的选择。交互式组件的样式就是一个典型用例。除非明确设置,否则默认为highlight 。
该属性在 Qt 6.6 中引入。
alternateBase : color
在具有交替行颜色的项目视图中用作备用背景色。
base : color
主要用作文本编辑器控件和项目视图的背景色。通常是白色或其他浅色。
brightText : color
与windowText 完全不同的文字颜色,可与dark 等形成鲜明对比。通常用于需要绘制文本的地方,如text 、windowText 或buttonText 会产生较差的对比度,如突出显示的按钮。
button : color
一般按钮的背景颜色。该背景可能与window 不同,因为某些样式要求按钮使用不同的背景色。
buttonText : color
与palette 颜色一起使用的前景色。
dark : color
与palette 颜色一起使用的前景色。
highlight : color
表示所选项目或当前项目的颜色。
highlightedText : color
与highlight 形成对比的文字颜色。
light : color
比button 更轻。
link : color
超链接使用的文字颜色。
linkVisited : color
用于已访问过的超链接的文字颜色。
mid : color
palette.button 和dark 之间。
midlight : color
button 和light 之间。
placeholderText : color [since 6.2]
用作可编辑单行字段的占位符颜色。
此属性在 Qt 6.2 中引入。
shadow : color
颜色很深。
text : color
与base 一起使用的前景色。这通常与windowText 相同,在这种情况下,它必须与window 和base 形成良好的对比。
toolTipBase : color
用作工具提示的背景色。
toolTipText : color
用作工具提示的前景色。
window : color
一般背景颜色。
windowText : color
一般前景色。
信号文件
changed()
附加信号表示该颜色组的当前状态已发生变化。通常是指其中一种颜色发生了变化。
注: 相应的处理程序是onChanged 。
© 2026 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.