简体   繁体   English

在Qt Creator调试器中显示定制信息“本地和表达式”

[英]Display tailored information in Qt Creator debugger “locals and expressions”

Win 7, Qt Creator, Qt 5.3, Win 7,Qt Creator,Qt 5.3,

If I want to display the content of my own classes in the Qt debugger, how can I do it? 如果我想在Qt调试器中显示自己的类的内容,该怎么办? Rather than displaying the technical details only, I want to provide a synopsis. 我想提供一个提要,而不是只显示技术细节。 So like for QStringList , or std:string in the screenshot below, I want to display a tailored string for my classes. 因此,就像下面的屏幕快照中的QStringListstd:string ,我想为我的类显示定制的字符串。

当地人和表达方式

Obviously there are addons I can install for certain libraries, eg for libstdc++ , see here . 显然,我可以为某些库(例如libstdc++安装插件,请参见此处 How can I achieve the same for my classes? 我如何在课堂上达到同样的目标?

The solution depends on the debugger backend you use. 解决方案取决于您使用的调试器后端。 For Windows that could be GDB (when using MinGW as compiler) or CDB (when using the MS compiler). 对于Windows,可能是GDB(使用MinGW作为编译器时)或CDB(使用MS编译器时)。 Extending the displayed formats is easiest for the GDB case, that allows Python to be used for the display generation. 对于GDB情况,扩展显示格式是最简单的,它允许使用Python来生成显示。 The code Qt Creator uses is under share/qtcreator/debugger/*.py, you can have a look at qttypes.py, stdtypes.py, boosttypes.py to get an idea of what do to. Qt Creator使用的代码位于share / qtcreator / debugger / *。py下,您可以查看qttypes.py,stdtypes.py,boosttypes.py来了解如何做。 Some overview is found in the "Extending the Python Based Debugging Helpers" section of the documentation, see http://qt-project.org/doc/qtcreator-3.1/creator-debugging-helpers.html 在文档的“扩展基于Python的调试帮助器”部分中找到一些概述,请参阅http://qt-project.org/doc/qtcreator-3.1/creator-debugging-helpers.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM