StyleKit QML Type
用于设置和获取当前样式的单例。更多内容...
| Import Statement: | import Qt.labs.StyleKit |
| Status: | Technology preview |
此类型处于技术预览阶段,可能会有变动。
属性
- debug : StyleKitDebug
- style : Style
- styleUrl : url
- 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 Controls。
// 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 : url
style 的另一种实现方式,用于从 URL 加载Style 。
另请参阅 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.