ImageWatch的QImage natvis [英] QImage natvis for ImageWatch
问题描述
嗨。
我在使用带有QImage的C ++ ImageWatch时遇到了一些问题。首先,这是我的.natvis
I have got some issues using the ImageWatch for c++ with QImage. First, here is my .natvis
<Type Name="QImage">
<AlternativeType Name="QImage<*>"/>
<UIVisualizer ServiceId="{A452AFEA-3DF6-46BB-9177-C0B08F318025}" Id="1" />
</Type>
<Type Name="QImage">
<Expand>
<Synthetic Name="[type]">
<DisplayString>UINT8</DisplayString>
</Synthetic>
<Synthetic Name="[channels]">
<DisplayString>BGRA</DisplayString>
</Synthetic>
<Item Name="[width]">d->width</Item>
<Item Name="[height]">d->height</Item>
<Item Name="[data]">d->data</Item>
<Item Name="[stride]">d->bytes_per_line</Item>
</Expand>
</Type>
现在我收到错误:
" Fehler:" Klasse" QImageData"" hat keinen会员"" width""。$
Fehler beim Auswerten von"d-> width" im Kontext von Typ" const ImageTest.exe!QImage"。"
"Fehler: "Klasse "QImageData"" hat keinen Member ""width"".
Fehler beim Auswerten von "d->width" im Kontext von Typ "const ImageTest.exe!QImage"."
这意味着d指针没有成员" with"。但在接下来的一行中我得到了:
Which means the d-pointer has no member "with". But in the next line i got:
"Der Ausdruck"d-> width" im Typkontext" QImage" wurde erfolgreich analysiert。"
"Der Ausdruck "d->width" im Typkontext "QImage" wurde erfolgreich analysiert."
这意味着"d-> with"成功分析了。
Which means "d->with" was successfull analised.
所以我的下一步是我想"好吧,d指针是QImageData。"所以我还将QImageData添加到natvis文件中。
So my next step was that i thought "Ok, the d-pointer is a QImageData." So i also added QImageData to the natvis file.
<Type Name="QImageData">
<AlternativeType Name="QImageData<*>"/>
<UIVisualizer ServiceId="{A452AFEA-3DF6-46BB-9177-C0B08F318025}" Id="1" />
</Type>
<Type Name="QImageData">
<Expand>
<Synthetic Name="[type]">
<DisplayString>UINT8</DisplayString>
</Synthetic>
<Synthetic Name="[channels]">
<DisplayString>BGRA</DisplayString>
</Synthetic>
<Item Name="[width]">width</Item>
<Item Name="[height]">height</Item>
<Item Name="[data]">data</Item>
<Item Name="[stride]">bytes_per_line</Item>
</Expand>
</Type>
但它没有帮助。
之后我创建了一个小类来访问我需要的数据。
After that i created a small class to access the data i need.
class MemPic
{
public:
MemPic(const QImage& image)
{
width = image.width();
height = image.height();
data = image.constBits();
bpl = image.bytesPerLine();
}
virtual ~MemPic() = default;
private:
int width;
int height;
const unsigned char* data;
int bpl;
};
并在.natvis中插入一个定义。
And inserted a definition into the .natvis.
<Type Name="MemPic">
<AlternativeType Name="MemPic<*>"/>
<UIVisualizer ServiceId="{A452AFEA-3DF6-46BB-9177-C0B08F318025}" Id="1" />
</Type>
<Type Name="MemPic">
<Expand>
<Synthetic Name="[type]">
<DisplayString>UINT8</DisplayString>
</Synthetic>
<Synthetic Name="[channels]">
<DisplayString>BGRA</DisplayString>
</Synthetic>
<Item Name="[width]">width</Item>
<Item Name="[height]">height</Item>
<Item Name="[data]">data</Item>
<Item Name="[stride]">bpl</Item>
</Expand>
</Type>
这一次有效。我可以在ImageWatch中看到图像。
And this time it works. I can see the image in ImageWatch.
但这对我来说不是解决方案。还有什么我可以做的来看QImage中的图像吗?
But this is not the solution for me. Is there anything else i can do to see the image from QImage?
谢谢
启
推荐答案
由于此问题与属于QT的QImage更相关,我建议您将此问题发布在
QT论坛,您将获得更多专业支持。
Since this issue is more related to QImage which belongs to QT, I recommend you post this issue at QT forum where you will get more professional support.
您的理解与合作将不胜感激。
Your understanding and cooperation will be grateful.
问候,
Fletcher
这篇关于ImageWatch的QImage natvis的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!