[PyKDE] QPixmap from a QVariant?
jan.ekholm at smultron.net
Mon Oct 30 20:44:59 GMT 2006
While playing with subclassing QItemDelegate using PyQt4 I stumbled upon a
little thing that I can't seem to figure out, nor do the docs seem to mention
In the QItemDelegate subclass and in the paint() method I get the QIcon that
should be used for the decoration role. That's fine, but the QIcon is in a
QVariant and the QVariant class has no QVariant.toIcon() method, one should
in C++ use code like:
QPixmap p = v.value<QIcon>(v);
How would one do that with PyQt? Any workarounds if it can't be cast to QIcon?
"Yes, bugger all that." said Nanny. "Let's curse somebody."
-- Terry Pratchett, Wyrd Sisters
More information about the PyQt