Visual studio 2012 and Qt4.8.5 : How to see QString contents in debug mode.

xavSIB picture xavSIB · Mar 11, 2014 · Viewed 15.5k times · Source

I use visual studio 2012 and Qt4.8.5, unfortunately I can not see the QString text variable when I work in debug mode. Is someone has a tip allow it ? Qt4.8.5 plug-in doesn't exist for VS2012.

Thank a lot

Xavier

Answer

DomTomCat picture DomTomCat · May 18, 2016

There is a quick and explicit solution (MSVC native, no need for plugins nor setting up .dat files), see my answer from here

Say you have QString str (Qt4), then add to the debugger watch window:

((str).d)->array,su 

the appendix ,su tells the debugger to interpret the data as unicode and null terminated string.

Note: For a Qt5 QString str it could be

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