StyleKit QML Type
用于设置和访问当前样式的单例。更多
| Import Statement: | import Qt.labs.StyleKit |
属性
- debug : StyleKitDebug
- style : Style
- styleUrl : string
- transitionsEnabled : bool
方法
- bool styleLoaded()
详细说明
StyleKit 是一个用于设置应用程序Style 的单例。
// Main.qml import QtQuick import Qt.labs.StyleKit ApplicationWindow { id: app width: 1024 height: 800 visible: true // Assign the style to be used StyleKit.style: PlainStyle {} // Controls are used as normal Column { anchors.fill: parent anchors.margins: 10 spacing: 10 Button { text: "Button" } Slider { width: 200 } } }
它还为全局 StyleKit 配置和调试提供属性。
注意: Qt.labs 模块中的类型不保证在未来版本中保持兼容。
另请参阅 Style 和StyleVariation 。
属性文档
debug : StyleKitDebug [read-only]
运行时调试工具,可用于跟踪特定Control 的样式属性。
style : Style
应用程序的活动样式。
将其设置为Style 实例,可将其应用于所有Qt Quick 控件。
// Main.qml import QtQuick import Qt.labs.StyleKit ApplicationWindow { id: app width: 1024 height: 800 visible: true // Assign the style to be used StyleKit.style: PlainStyle {} // Controls are used as normal Column { anchors.fill: parent anchors.margins: 10 spacing: 10 Button { text: "Button" } Slider { width: 200 } } }
注意: 为获得最佳启动性能,请在根ApplicationWindow 上设置样式,然后再设置子控件。
styleUrl : string
另请参阅 style 。
transitionsEnabled : bool
控制是否全局启用过渡效果。
将其设置为false 可禁用当前样式中的所有过渡效果。
默认值为true 。
另请参阅 ControlStyle::transition 。
方法文档
bool styleLoaded()
© 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.