调试应用程序
您可以调试
- 使用 Visual Studio 调试器调试 Qt C++ 应用程序。
- Qt Quick 使用QML 调试引擎调试 Qt C++ 应用程序。
- 使用 GDB 调试 Linux 上的应用程序。
开始调试
启动调试会话:
- 转到Debug >Start Debugging 。
- 要调试 CMake 项目,请在Solution Explorer 中选择主源文件,然后在上下文菜单中选择Set as Startup Item 。
- 按F5。
设置断点
在 C++ 和 QML 文件中设置断点,并逐步执行代码。在断点模式下,可观察变量并更改其值,以及评估任意表达式。对于Qt Quick 应用程序,QML 调试会话与 C++ 调试会话同时运行,这使您能在同一调试会话中设置断点并观察 C++ 和 QML 中的变量。
另请参阅 教程:Qt Quick 调试、交叉编译、在 Linux 上调试、启用 QML 调试、调试Qt Quick 应用程序和可视化 C++ 类型。
© 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.