Unfortunately to the rest of you, the explanations are in russian, so you must try harder I guess ;). OK, don't despair, spending my childhood in a communist country finaly pays out ;) - here comes a short explanation how to create and install the visualizer. 1. Take this code and save it as (for example) qt4and5.natvis :
<?xml version="1.0" encoding="utf-8"?> <AutoVisualizer xmlns="http://schemas.microsoft.com/vstudio/debugger/natvis/2010"> <!-- Qt 4 --> <Type Name="QString"> <DisplayString>{d->data,su}</DisplayString> <StringView>d->data,su</StringView> <Expand> <Item Name="[size]">d->size</Item> <Item Name="[referenced]">d->ref._q_value</Item> <ArrayItems> <Size>d->size</Size> <ValuePointer>d->data,c</ValuePointer> </ArrayItems> </Expand> </Type> <Type Name="QByteArray"> <DisplayString>{d->data,s}</DisplayString> <StringView>d->data,s</StringView> <Expand> <Item Name="[size]">d->size</Item> <Item Name="[referenced]">d->ref._q_value</Item> <ArrayItems> <Size>d->size</Size> <ValuePointer>d->data,c</ValuePointer> </ArrayItems> </Expand> </Type> <!-- Qt 5 <Type Name="QString"> <DisplayString>{((reinterpret_cast<unsigned short*>(d)) + d->offset / 2),sub}</DisplayString> <StringView>((reinterpret_cast<unsigned short*>(d)) + d->offset / 2),sub</StringView> <Expand> <Item Name="[size]">d->size</Item> <Item Name="[referenced]">d->ref.atomic._q_value</Item> <ArrayItems> <Size>d->size</Size> <ValuePointer>((reinterpret_cast<unsigned short*>(d)) + d->offset / 2),c</ValuePointer> </ArrayItems> </Expand> </Type> <Type Name="QByteArray"> <DisplayString>{((reinterpret_cast<char*>(d)) + d->offset),sb}</DisplayString> <StringView>((reinterpret_cast<char*>(d)) + d->offset),sb</StringView> <Expand> <Item Name="[size]">d->size</Item> <Item Name="[referenced]">d->ref.atomic._q_value</Item> <ArrayItems> <Size>d->size</Size> <ValuePointer>((reinterpret_cast<char*>(d)) + d->offset),c</ValuePointer> </ArrayItems> </Expand> </Type> --> </AutoVisualizer>2. Copy this file to: C:\Users\Your_User_Name_Here\Documents\Visual Studio 2013\Visualizers 3. Restart VisualStudio! That's all! After that, I'm able to see QString's and QByteArray's contents, and I hope you're able too! At the moment I'm still using Qt 4.8 for the current project, but the switch to Qt 5.2 is pending. When it arrives, I'll just uncomment the Qt.5 section in the file, and will be happy - or at least I hope so. --
* OK, the solution for VS 2012 + Qt 5.2 does show up, but my constraints are somehow more generic than that.
3 comments:
You could also take qt4.natvis and qt5.natvis from https://qt.gitorious.org/qt-labs/vstools
@hmuelner
Thanks! Alas, only qt5 visualizer could be easily found, qt4 seems to be elswhere.
It's amazing how much time a simple blog post can save. Thanks a ton!
Post a Comment