在本页

SystemPalette QML Type

提供对 Qt 调色板的访问。更多

Import Statement: import QtQuick

属性

详细说明

SystemPalette 类型提供了对 Qt 应用程序调色板的访问。它提供了用于应用程序窗口、按钮和其他功能的标准颜色信息。这些颜色分为三个颜色组activeinactivedisabled 。有关颜色组和 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.InactiveQPalette::Inactive
SystemPalette.DisabledQPalette::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.