I want to create a natvis for QObject. There are dynamic properties concepts, which stored in form
QList<QByteArray> propertyNames;
QVector<QVariant> propertyValues;
and I want to group them and visualize as a map(key-value items).
My natvis is pretty simple (for illustration purposes, I replaced all complex logic of getting data from QList and QVector with _GetNameAsVoidPtr and _GetValueAsVoidPtr):
<Type Name="QObject">
...
<Synthetic Name="dynamic_properties">
<DisplayString>{{ size = {propertyNames.d->end - propertyNames.d->begin} }}</DisplayString>
<Expand>
<CustomListItems>
<Variable Name="index" InitialValue="0" />
<Variable Name="size" InitialValue="propertyNames.d->end - propertyNames.d->begin" />
<Loop>
<Break Condition="index >= size" />
<Item Name="[{index}] {*reinterpret_cast<const QByteArray*>(_GetNameAsVoidPtr(index))}">
{*reinterpret_cast<const QVariant*>(_GetValueAsVoidPtr(index))}
</Item>
<Exec>++index</Exec>
</Loop>
</CustomListItems>
</Expand>
</Synthetic>
...
</Type>
I get the following error:
Natvis: QObject.natvis(217,21): Error: constant "QByteArray" is not a type name
Error while evaluating '*reinterpret_cast<const QByteArray*>(_GetNameAsVoidPtr(index))' in the context of type 'Qt5Cored.dll!QObject'.
Natvis: QObject.natvis(217,21): Error: constant "QVariant" is not a type name
Error while evaluating '*reinterpret_cast<const QVariant*>(_GetValueAsVoidPtr(index))' in the context of type 'Qt5Widgetsd.dll!QObject'.
I tried to replace reinterpret_cast<const QByteArray*> with reinterpret_cast<const Qt5Cored.dll::QByteArray*>, removed const and other things - nothing worked. Then I printed these values in VS-Watch window and get the following picture:

And here I realised, that Qt has classes: class QByteArray and class QVariant,
also, it has enum QMetaType::Type with values QByteArray and QVariant.
In most places, natvis use types as-is(as you type them in xml), but for some reason, inside CustomListItems section, it adds the module name in the front of all types.
So, instead of QByteArray and QVariant, it treat them as ModuleName.dll!QByteArray and ModuleName.dll!QVariant. The same for QString, for instance. And as you can see on screenshot from Watch window, Visual studio interpet classes with explicit ModuleName.dll prefix as enum-values(not classes).
It there any way to to specify explicitly that QVariant is a class, not an enum?
I tried to add double colons(::QVariant) or "class" keyword(class QVariant) - does not work :(
I have some ideas how to workaround that issue(if some of them work - i will reply), but first of all, I am curios is there proper way, to tell compiler that it is a class-name?
