SystemPalette QML Type
提供对 Qt 调色板的访问。更多...
| Import Statement: | import QtQuick |
属性
- accent : color
(since 6.7) - alternateBase : color
- base : color
- button : color
- buttonText : color
- colorGroup : enumeration
- dark : color
- highlight : color
- highlightedText : color
- light : color
- mid : color
- midlight : color
- placeholderText : color
(since 6.2) - shadow : color
- text : color
- window : color
- windowText : color
详细说明
SystemPalette 类型提供了对 Qt 应用程序调色板的访问。它提供了关于应用程序窗口、按钮及其他功能所使用的标准颜色的信息。这些颜色被划分为三个颜色组:active 、inactive 和disabled 。有关颜色组以及 SystemPalette 提供的属性的详细信息,请参阅QPalette 文档。
这可用于为控件上色,从而呈现更接近原生应用程序的外观和感觉。
以下示例从“Active ”颜色组创建一个调色板,并利用该调色板为窗口和文本项设置适当的颜色:
import QtQuick
Rectangle {
SystemPalette { id: myPalette; colorGroup: SystemPalette.Active }
width: 640; height: 480
color: myPalette.window
Text {
anchors.fill: parent
text: "Hello!"; color: myPalette.windowText
}
}另请参阅 QPalette 。
属性文档
accent : color [read-only, since 6.7]
当前颜色组的强调色。
该属性自 Qt 6.7 起引入。
另请参阅 QPalette::ColorRole 。
alternateBase : color [read-only]
当前颜色组的备用底色。
另请参阅 QPalette::ColorRole 。
base : color [read-only]
当前颜色组的基色。
另请参阅 QPalette::ColorRole 。
button : color [read-only]
当前颜色组的按钮颜色。
另请参阅 QPalette::ColorRole 。
buttonText : color [read-only]
当前颜色组中按钮文本的前景色。
另请参阅 QPalette::ColorRole 。
colorGroup : enumeration
调色板的颜色组。可以是以下选项之一:
| 常量 | 描述 |
|---|---|
SystemPalette.Active | (默认)QPalette::Active |
SystemPalette.Inactive | QPalette::Inactive |
SystemPalette.Disabled | QPalette::Disabled |
另请参阅 QPalette::ColorGroup 。
dark : color [read-only]
当前颜色组的深色。
另请参阅 QPalette::ColorRole 。
highlight : color [read-only]
当前颜色组的突出显示色。
另请参阅 QPalette::ColorRole 。
highlightedText : color [read-only]
当前颜色组的高亮文本颜色。
另请参阅 QPalette::ColorRole 。
light : color [read-only]
当前颜色组的浅色。
另请参阅 QPalette::ColorRole 。
mid : color [read-only]
当前颜色组的中间色。
另请参阅 QPalette::ColorRole 。
midlight : color [read-only]
当前颜色组的中间色。
另请参见 QPalette::ColorRole 。
placeholderText : color [read-only, since 6.2]
当前颜色组的占位符文本颜色。
该属性自 Qt 6.2 起引入。
另请参阅 QPalette::ColorRole 。
shadow : color [read-only]
当前颜色组的阴影颜色。
另请参阅 QPalette::ColorRole 。
text : color [read-only]
当前颜色组的文本颜色。
另请参阅 QPalette::ColorRole 。
window : color [read-only]
当前颜色组的窗口(通用背景)颜色。
另请参阅 QPalette::ColorRole 。
windowText : color [read-only]
当前颜色组的窗口文本(常规前景色)颜色。
另请参阅 QPalette::ColorRole 。
© 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.