本页内容

Windows 样式

Windows 样式是一种在 Windows 系统上看起来原生风格的样式。更多...

导入语句: import QtQuick.Controls.Windows
自: Qt 6.0

Windows 样式是一种在 Windows 系统上呈现原生外观的样式。控件在运行时通过原生库进行绘制,因此仅适用于在 Windows 上运行的应用程序。

注意:请 注意,为了更好地与该平台上的原生应用程序融合,此样式的外观可能会在不同的 Qt 小版本之间发生变化。

带有 Windows 风格“字体大小”单选按钮和“音量”滑块的设置界面

Windows 样式

若要以 Windows 样式运行应用程序,请参阅《Qt Quick Controls 》中的“使用样式”一节。

当前状态

Windows 样式目前正在开发中,部分控件尚不支持。这些控件包括:BusyIndicator 、PageIndicator 、TabBar 和Tumbler 。这些控件将回退为使用Fusion 样式。

自定义

Windows 样式的目标是使控件的外观和操作体验尽可能接近 Windows 上的原生控件。该样式将遵循在 Windows 设置中全局配置的主题和颜色,除此之外,不提供单独的自定义 API。

注意:Windows 样式 不适合用于自定义。主要原因是它有时会将内容和背景同时绘制到单个背景项上,这与自定义 contentItem 结合使用时效果不佳。此外,它使用的 padding 和 inset 值往往与其他样式不同。 因此,建议始终基于在所有平台上均可用的一种样式(例如Basic Style、Fusion Style、Imagine Style、Material Style 或Universal Style)来构建自定义控件。这样可以确保无论应用程序使用哪种样式运行,其外观始终保持一致。 要了解如何使用不同的样式,请参阅《Qt Quick Controls 》中的“使用样式”部分。此外,您还可以创建自己的样式。

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