[PyQt] Construct QVariant from object of user type

Phil Thompson phil at riverbankcomputing.com
Thu Apr 24 16:55:14 BST 2008

Tonight's PyQt snapshot will have some support for storing a Python object in 
a QVariant so the following code works...

from PyQt4.QtCore import QVariant

class Klass(object): pass

k = Klass()
v = QVariant(k)
v1 = QVariant(v)
assert v1.toPyObject() is k

Let me know if more is needed.


More information about the PyQt mailing list