qmlpreview

Qml 预览

QML 预览工具可观察磁盘上的 QML 和 JavaScript 文件,并根据任何变化实时更新应用程序。要预览的应用程序必须启用 QML 调试。更多

使用方法
qmlpreview[options] executable [parameters...] [选项] 可执行文件 [参数...

选项

选项说明
-verbose打印调试输出。
-h、-help显示命令行选项的帮助。
-help-all显示帮助,包括通用 Qt 选项。
-v, -version显示版本信息。

参数

参数说明
可执行文件加载 QML 文档的可执行文件路径。
参数可执行文件的参数

详细信息

启用 QML 调试

要启用 QML 调试,请确保使用适当的配置参数构建应用程序。使用 qmake 时,应在.pro 文件中添加CONFIG+=qml_debug 。如果使用其他构建系统,则应定义QT_QML_DEBUG 变量。

qt_add_executable(MyApp
...
)

target_compile_definitions(MyApp PRIVATE QT_QML_DEBUG)

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