StyleKitDebug QML Type
跟踪控件的样式属性是如何解析的。更多
| Import Statement: | import Qt.labs.StyleKit |
属性
详细说明
StyleKitDebug 是一种诊断工具,可将样式属性读取记录到调试输出中。它有助于了解控件最终呈现特定外观的原因,尤其是在涉及多个themes 或style variations 的复杂样式中。
可通过StyleKit.debug 访问该工具。
注意: 该工具是试验性的。启用它将严重降低性能,只能用于调试。在未来版本中,输出格式可能会发生变化。
要开始跟踪,请将Control 的id赋值给control 属性:
StyleKit.debug.control = myButton
每个解析的属性都会打印成一行,显示值的来源和解析的内容:
[read] StyleReader[Normal].button.background.color -> button[Normal] = #ff0000
使用filter 将输出限制为感兴趣的属性。
注意: Qt.labs 模块中的类型不保证在未来版本中保持兼容。
另请参阅 StyleKit::debug 。
属性文档
control : Item
设置后,StyleKit 会将此项目的所有样式属性读取记录到调试输出中。设置为null 则停止跟踪。
另请参阅 filter 。
filter : string
正则表达式,用于过滤调试输出。只打印与模式匹配的行。默认情况下,显示所有输出。
例如,只显示背景颜色的读数:
StyleKit.debug.filter = "background.color"
另请参见 control 。
© 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.