Reputation: 14081
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, e.g. for libstdc++
, see here . How can I achieve the same for my classes?
Upvotes: 2
Views: 409
Reputation: 126
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
Upvotes: 3