Reputation: 21
by default visual studio debugger does not show QString, QByteArray or similar data type values. by searching I found out that I should install Qt vs tools and it will create a .natvis file which will help Visual Studio to show these values. after installing it on VS 2022, the debugger shows those values, but only on simple variables. I mean if you hover on an object that has a QString member, the value of that QString is not shown and only a memory address is shown. I did not have this problem on VS 2019.
here is a simple example to know what I mean.
class testclass
{
public:
QString testString;
testclass(QString v)
{
testString = v;
}
};
void testFunc()
{
testclass* obj= new testclass("123"); //debugger does not show value of testString when expanding obj value
auto string= obj->testString; // does show value of string.
}
also the qt5.natvis file on VS 2019 and the one On VS 2022 are the same.
Upvotes: 2
Views: 2551
Reputation: 21
After installing Qt VS Tools for Visual Studio 2022 i was able to see a human readable string in QString objects while debugging. Neither did i bother to set them up nor do I know if these tools generated a .nativs file.
Upvotes: 2