macOS 风格
macOS 风格是一种在 macOS 上看起来原生样式的设计风格。更多...
| 导入语句: | import QtQuick.Controls.macOS |
| 自: | Qt 6.0 |
macOS 样式是一种在 macOS 上呈现原生外观的样式。控件在运行时使用原生框架进行绘制,因此仅适用于在 macOS 上运行的应用程序。
注意:请 注意,为了更好地与该平台上的原生应用程序融合,此样式的外观可能会在不同的 Qt 小版本之间发生变化。
macOS 样式的浅色主题。 |
macOS 样式的深色主题。 |
要运行采用 macOS 样式的应用程序,请参阅《Qt Quick Controls 》中的“使用样式”一节。
当前状态
macOS 样式目前正在开发中,部分控件尚不支持。这些控件包括:BusyIndicator 、DelayButton 、PageIndicator 、RangeSlider 、Switch 、TabBar 和Tumbler 。这些控件将回退至使用Fusion 样式。
自定义
macOS 样式的目标是使控件的外观和操作体验尽可能接近 UIKit 中的原生控件。该样式将遵循“系统偏好设置”中全局配置的主题和颜色,除此之外,不提供单独的自定义 API。
注意: macOS样式 不适合用于自定义。主要原因是它有时会将内容和背景同时绘制到同一个背景项上,这与自定义的 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.

