ColorGroup QML Type

按角色划分的颜色集。更多

Import Statement: import QtQuick
Inherits:

QtObject

Inherited By:

Palette

属性

信号

详细说明

ColorGroup 类型用于定义一组具有特定作用的颜色。虽然 ColorGroup 没有视觉外观,但它定义了用于自定义渲染项的颜色。

颜色的默认值等于默认构建的活动组颜色QPalette

以下代码可用于创建一个指定了某些颜色的颜色组:

ColorGroup {
    alternateBase: "red"
    base: "green"
}

Palette 类型为每个 QML 项目状态公开了颜色组。

属性文档

accent : color [since 6.6]

通常与basewindowbutton 颜色形成对比或相互衬托的颜色。它通常代表用户对桌面个性化的选择。交互式组件的样式就是一个典型的用例。除非明确设置,否则默认为highlight

该属性在 Qt 6.6 中引入。


alternateBase : color

在具有交替行颜色的项目视图中用作交替背景色。


base : color

主要用作文本编辑器控件和项目视图的背景色。它通常是白色或其他浅色。


brightText : color

windowText 完全不同的文本颜色,与dark 等形成鲜明对比。通常用于需要绘制文本的地方,如textwindowTextbuttonText 等对比度较低的地方,如高亮按钮上。


button : color

一般按钮背景色。该背景可能与window 不同,因为某些样式要求按钮使用不同的背景色。


buttonText : color

palette 颜色一起使用的前景色。


dark : color

palette 颜色一起使用的前景色。


highlight : color

表示选定项目或当前项目的颜色。


highlightedText : color

highlight 对比的文本颜色。


light : color

button 浅。


用于超链接的文本颜色。


linkVisited : color

用于已访问过的超链接的文本颜色。


mid : color

介于palette.buttondark 之间。


midlight : color

介于buttonlight 之间。


placeholderText : color [since 6.2]

用作可编辑单行字段的占位符颜色。

该属性在 Qt 6.2 中引入。


shadow : color

非常暗的颜色。


text : color

base 一起使用的前景色。它通常与windowText 相同,在这种情况下,它必须与windowbase 形成良好的对比。


toolTipBase : color

用作工具提示的背景色。


toolTipText : color

用作工具提示的前景色。


window : color

一般背景色。


windowText : color

一般前景色。


信号文档

changed()

附加信号表示该颜色组的当前状态已更改。通常是指其中一种颜色发生了变化。

注: 相应的处理程序是onChanged


© 2025 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.