0
QString str = "hello";

When I debug the code in Visual Studio 2010 and add a watch to str, I'm unable to get the data it contains as a string. The watch shows only the internal byte array.

How can I get the value of a QString as a text string, rather than a byte array?

I tried in VS2008 as well, and i was getting the value as text string.

IPS
  • 81
  • 1
  • 12
  • Post a screenshot of what the variable is looking in the debugger. Also see these similar questions - https://stackoverflow.com/questions/22324166/visual-studio-2012-and-qt4-8-5-how-to-see-qstring-contents-in-debug-mode and http://www.qtcentre.org/threads/33200-QString-is-not-shown-properly-in-Watch-%28Qt-Add-in-1-1-5-for-Visual-Studio-2008%29. Maybe the solutions there will work. – sashoalm Mar 20 '15 at 07:10

1 Answers1

0

You need Qt Visual Studio Add-in or write your own debugger type visualizer:

http://wiki.qt.io/IDE-debug-helpers

tomvodi
  • 5,577
  • 2
  • 27
  • 38
svlasov
  • 9,923
  • 2
  • 38
  • 39