确定8个字节的数据的性质(Determining the nature of 8 bytes of Data)

编程入门 行业动态 更新时间:2024-10-25 16:20:09
确定8个字节的数据的性质(Determining the nature of 8 bytes of Data)

这里是上下文:我正在开发一个Maya插件。 其中一个功能要求我将Outliner窗口中的元素拖放到我的插件UI的UI元素上。 (Maya中的所有内容都在Qt中)从大纲中,我可以拖动项目并将其放下。 对于任何熟悉Qt的人,您都会知道DropEvent附带了一个QMimeData对象。 该对象包含来自拖放源(大纲视窗)的数据。 在我的情况下,QMimeData格式是“application / x-maya-data”。 由QMimeData.data()返回的QByteArray长度为8个字节,前4个为NULL。 所以,我的直觉是这是一个指向某种数据类型的指针。

所以,这里有一个问题:有没有办法确定一个指针指向什么类型的数据? 我试过把它转换成一些Maya数据结构(MPxData,MObjectHandle等),但没有成功。

Here's the context: I am working an a Maya Plugin. One of the features require me to Drag an element from the Outliner Window onto a UI element of my plugins UI. (Everything in Maya is in Qt) From the outliner, i can drag an item and drop it. For anyone familiar with Qt, you will know that the DropEvent comes with a QMimeData object. This object contains data from the drag&drop source (the Outliner window). In my case, the QMimeData format is "application/x-maya-data". The QByteArray returned by QMimeData.data() is 8 bytes long, the first 4 beeing NULL. So, my hunch is that this is a pointer to some Data Type.

So, here's the question: Is there ANY way of determining what type of data a pointer points to? I've tried casting it into a few Maya data structures (MPxData, MObjectHandle, etc) but without success.

最满意答案

你可以尝试删除它两次,然后在内存调试器(如valgrind )中运行你的程序,它会抛出一个错误,并告诉你内存分配的位置。

但是,您也可以考虑社交来源:文档或项目的邮件列表。

You could try deleting it twice and then running your program in a memory debugger (like valgrind), which will throw an error and show you where the memory has been allocated.

However, you might also consider social sources: the documentation or the project's mailing list.

更多推荐

本文发布于:2023-07-26 02:44:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1269944.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:字节   性质   数据   Determining   bytes

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!