IDE Debug Helpers

Qt Creator

Qt Creator directly supports introspection of all Qt Containers and QObject derived classes for Qt 4 and Qt 5. User defined types can be supported in addition, see the Qt Creator documentation for details.


There is an effort to introspect Qt types using LLDB at

KDevelop ships formatter scripts in its LLDB plugin for Qt types that can be used directly in plain LLDB.

MS visual studio QString & QByteArray expansions

The new layout of QString in Qt 5 is hard to inspect using the debugger. The following code can be added to autoexp.dat (c:\program files(x86)\visual studio 9.0\common7\packages\debugger\autoexp.dat) You should add it to the [Visualizer] section, before the STL/ATL containers.

; Qt types QStringData{  preview ([(unsigned short*)$e.d + $e.offset,su])  stringview ([(unsigned short*)$e.d + $e.offset,sub]) } QString{  preview ([$e.d]) } QByteArrayData{  preview ([(unsigned char*)$e.d + $e.offset,s])  stringview ([(unsigned char*)$e.d + $e.offset,sb]) } QByteArray{  preview ([$e.d]) } 

If all else fails you can always just add a watcher for

  (char*)str.d + str.d->offset,su 

in the debugger, to see the contents of str.