[Interest] how can I call qRegisterMetaType?

Thiago Macieira thiago.macieira at intel.com
Tue May 17 05:42:45 CEST 2016


On terça-feira, 17 de maio de 2016 11:41:59 PDT Hamish Moffatt wrote:
> It seems that for a metatype that is a QList<MyClass::MyEnum> I must
> call qRegisterMetaType with the name specified, else reading properties
> complains that the metatype isn't registered. What worries me is that
> the type name must be specified without the class, as in
> 
> qRegisterMetaType<QList<MyClass::MyEnum>>("QList<MyEnum>");
> 
> If I have another enum MyOtherClass::MyEnum am I going to have collisions?

Yes.

Always register metatypes with their full names, always use the full name in 
signals and slots. That's what happens when string comparisons are used.

-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center




More information about the Interest mailing list