Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Display QString (Qt5) content in Visual Studio 2013 debugging?

I used to google a lot about it.

  • I enabled Debugging -> Edit and Continue in Native Only options
  • I was trying to add Visualizers to Visual Studio 2013\Visualizers
  • vstools project on codeplex is not for 2013 seems like

but so far nothing helps...

like image 928
cnd Avatar asked Apr 20 '15 10:04

cnd


3 Answers

I know this question is a while back but if relevant, for VS 2013 then go to

"C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\Packages\Debugger\Visualizers"

and add Code from below link in a text file and name it qt5.natvis. For VS 2019 the location would be:

C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\Packages\Debugger\Visualizers"

Hope this helps.

pastebin code for seeing qt variables in visual studio

like image 141
Sam Avatar answered Oct 17 '22 00:10

Sam


There is an explicit, native MSVC solution without the use of plugins etc.: see my answer from here

Say you have QString str, then add to the debugger session watch window:

Qt4:

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

for Qt5 it's slightly more complicated:

(char*)str.d + str.d->offset,su
like image 28
DomTomCat Avatar answered Oct 16 '22 23:10

DomTomCat


I search this problem's answer for a long time, and final success saw the QString content by try check/uncheck mentioned options. Hope can help others.

display qstring content

  1. Install qt-vs-addin-msvc2013-2.0.0-beta.vsix
  2. Uncheck TOOLS->Debugging->Edit and Continue->Enable native Edit and Continue
    Uncheck TOOLS->Debugging->Edit and Continue->Enable native Edit and Continue
like image 39
tiegeda Avatar answered Oct 16 '22 23:10

tiegeda