PyQt: Pulling Abstract Item Data from Mime Data using Drag and Drop.
david at boddie.org.uk
Sat Dec 13 01:17:25 CET 2008
On Friday 12 December 2008 02:05, Mudcat wrote:
> The drag is working up until the point I try to actually retrieve the
> data. At that point I get an unhandled Runtime Error saying "no access
> to protected functions or signals for objects not created in Python".
That's correct, retrieveData() is a protected function in C++ and the
QMimeData object was created by the framework, not you, in this case.
> Obviously I am not retrieving them in the correct format. Does anyone
> know how to convert/retrieve the information into a Python list?
You could use the data() method to get the serialized data then try to
extract the list item-by-item using the QDataStream class, or perhaps
PyQt has a convenience function to unpack the items.
Alternatively - and this is a bit speculative - perhaps you can copy
the data to another QMimeData object which you have created, and use
its retrieveData() method to retrieve the items.
You might get a more detailed response by asking on the PyQt mailing list:
Hope this helps,
More information about the Python-list