[Qt-interest] QVariant::type() usage for custom QVariant types

Eckhard Jokisch e.jokisch at orange-moon.de
Thu Jul 28 17:10:32 CEST 2011


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

Ok - now I understood.

Thanks a lot

Eckhard

On 07/28/11 16:34, Thiago Macieira wrote:
> On Thursday, 28 de July de 2011 16:21:35 Eckhard Jokisch wrote:
>> Thanks for the relply. I already tried that one - but how do I
>> define the number that userType() shall return? there is not
>> something like
>> 
>> variant.setUserType(int type,QString typeName)?
>> 
>> I need to know at compiletime what number will be returned  -
>> otherwise I can't use "switch".
> 
> You don't define it.
> 
> The number is computed at runtime when you register the type (via 
> qRegisterMetaType). The value returned from the registration is the
> ID you have to use.
> 
> You can also get the same ID by calling qMetaTypeId<Type>().
> 
> So: you can't use a switch.
> 
> 
> 
> 
> _______________________________________________ Qt-interest mailing
> list Qt-interest at qt.nokia.com 
> http://lists.qt.nokia.com/mailman/listinfo/qt-interest

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

iEYEARECAAYFAk4xe+gACgkQDmkomQAAlrYIIQCghJjYI6nWxKwasbYMWTt95V9K
3K8An2Uia4eu/cLeZLarLp6ybSNHvL8M
=TfBV
-----END PGP SIGNATURE-----



More information about the Qt-interest-old mailing list