[PyKDE] QVariant and QIcon

Andreas Pakulat apaku at gmx.de
Wed Nov 1 16:38:05 GMT 2006


On 01.11.06 16:59:39, Torsten Marek wrote:
> in connection with Qt::DecorationRole, an implementation of a model's data
> method is supposed to return an icon in a QVariant. In C++, I guess this is done
> using the QVariant ( int typeOrUserType, const void * copy ) constructor,

No, in C++ most of the conversions to QVariant are implicit, i.e. in a
models data function you'd have:

return myicon;

And it would work.

> because there is no explicit constructor taking a QIcon.
> This method is wrapped in PyQt4, but I can't use it with a QIcon:

IIRC QVariant(youricon) should work in PyQt4. See the examples that come
with PyQt4, especially itemviews/puzzle

Andreas

-- 
Excellent day for putting Slinkies on an escalator.




More information about the PyQt mailing list