这里是上下文:我正在开发一个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.
更多推荐
发布评论