融合风格

Fusion 风格是一种面向桌面的风格。

Fusion 风格是一种与平台无关的风格,提供面向桌面的外观和感觉。它采用与 Qt Widgets.NET 的 Fusion 风格相同的设计语言。

Fusion 风格会根据系统设置自动切换深色和浅色主题。有关如何设置自定义主题颜色的信息,请参阅 "自定义"部分。

Fusion 风格的浅色主题。

Fusion 风格的深色主题。

要使用 Fusion 风格运行应用程序,请参阅 Qt Quick Controls 中的 "使用风格"。

注意: Fusion 风格不是本地桌面风格。该样式可在任何平台上运行,在任何地方看起来都差不多。由于标准系统调色板、可用字体和字体渲染引擎的不同,可能会出现细微差别。

自定义

Fusion 风格使用标准系统Palette 提供与桌面环境相匹配的颜色。

您可以为任何控件、popupapplication window 指定自定义调色板。显式调色板属性会自动从父属性传播到子属性,并覆盖该属性的任何系统默认值。在下面的示例中,窗口和所有三个开关的高亮颜色均为紫色:

import QtQuick 2.12
import QtQuick.Controls 2.12

ApplicationWindow {
    visible: true

    palette.highlight: "violet"

    Column {
        anchors.centerIn: parent

        Switch { text: qsTr("First"); checked: true }
        Switch { text: qsTr("Second"); checked: true }
        Switch { text: qsTr("Third") }
    }
}

另请参阅 基本样式材质样式通用样式

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