简体   繁体   中英

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

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? 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.

当地人和表达方式

Obviously there are addons I can install for certain libraries, eg for libstdc++ , see here . 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). Extending the displayed formats is easiest for the GDB case, that allows Python to be used for the display generation. 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. 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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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