[Qt-interest] QVariant and user defined types

Mihail Naydenov mlists at ymail.com
Tue Jun 1 15:32:51 CEST 2010


Read the docs about Q_ENUM and QVarinat

The it is documented how to register custom types.


----- Original Message ----
> From: Justus Best <Just18 at gmx.de>
> To: Qt-interest at trolltech.com
> Sent: Tue, June 1, 2010 2:52:07 PM
> Subject: [Qt-interest] QVariant and user defined types
> 
> Hi,

I currenty stuck a little while trying to add some of my classes to 
> 
QVariant.
My problem is that I can't find a way to put my Types in an 
> enum and use 
them in a switch case with QVariant::userType().
I tried 
> with an enum like :
enum MyTypes { Type1 = QVariant::UserType, Type2, 
> Type3,  Type4, Type5 };
But this doesn't correspond with the TypeIds I 
> get if I call 
QVariant::userType().

So is there any possibility to 
> use QVariant with user definded types in 
a switch statment ?

Kind 
> regards Justus
_______________________________________________
Qt-interest 
> mailing list

> href="mailto:Qt-interest at trolltech.com">Qt-interest at trolltech.com

> href="http://lists.trolltech.com/mailman/listinfo/qt-interest" target=_blank 
> >http://lists.trolltech.com/mailman/listinfo/qt-interest


      



More information about the Qt-interest-old mailing list