[PyKDE] QVariant and QIcon

Torsten Marek shlomme at gmx.net
Wed Nov 1 21:04:26 GMT 2006


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Andreas Pakulat schrieb:
> 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
> 

Hi,

that's really to easy.. Thanks for the tip, works marvelously.

best

Torsten
- --
Torsten Marek <shlomme at gmx.net>
ID: A244C858 -- FP: 1902 0002 5DFC 856B F146  894C 7CC5 451E A244 C858
Keyserver: subkeys.pgp.net

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFSQvafMVFHqJEyFgRAnBlAJsFSqZG49G7SZ25ofgIH9AS7RoZOwCgugqi
EiPMtuQG0mNygff76ZEzfOo=
=1QPd
-----END PGP SIGNATURE-----




More information about the PyQt mailing list