[PyQt] MIMEdata and QVariant class problem

Anshul Jain aj.phoenixter at gmail.com
Fri Apr 2 10:53:31 BST 2010


Hello,

I have been trying to do drag and drop of icons using MIMEdata class. in my
code I have written:

image= event.mimeData().imageData().  Qt returns a QVariant type value after
executing this statement *(
http://doc.qt.nokia.com/qt-maemo-4.6/qmimedata.html#imageData*). Thus image
is a QVariant.


Now to get the imageData as QImage i need to use QVariant.value<QImage>()
 function like one below:

img= QtGui.QImage()
img= image.value<QImage>()

Here's the description:
http://www.riverbankcomputing.co.uk/static/Docs/PyQt4/html/qvariant.html#qVariantValue


But the problem is that whenever I run this I get the following error:

img= image.value<QtGui.QImage>()
AttributeError: 'QVariant' object has no attribute 'value'


Please tell me what is the reason for this error. kindly help me on this.


Regards
Anshul
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20100402/812dafc5/attachment.html>


More information about the PyQt mailing list