[PyQt] QVariant TypeError on python class, but not on Qt class
Drew Vogel
dvogel at intercarve.net
Wed Apr 4 03:01:42 BST 2007
Consider this listing:
1.
from PyQt4 import QtCore
2.
from PyQt4 import QtGui
3.
4.
5.
# This works
6.
i = QtGui.QIcon()
7.
qi = QtCore.QVariant(i)
8.
9.
10.
# This throws TypeError: argument 1 of QVariant() has invalid type
11.
class C:
12.
def __init__(self, v):
13.
self.value = v
14.
15.
x = C(100)
16.
qx = QtCore.QVariant(x)
Why does line 16 throw TypeError, but line 7 does not? I suspect that it
has something to do with "x" being a python class and "i" being a Qt
class, but I don't see anything in the QVariant documentation mentioning
a difference. Is this supposed to be supported?
Drew Vogel
More information about the PyQt
mailing list