Register a named type in the meta object system
From qtnode
You can register a type in the meta object system either at compile-time or run-time.
For instance if you had an object named SomeType and you needed to register it (maybe you are passing is as a parameter to a queued slot)...
To register the type at run-time:
qRegisterMetaType<SomeType>("SomeType");
To register the type at compile-time:
Q_DECLARE_METATYPE(SomeType);
Links:
- QMetaType documentation: http://doc.trolltech.com/latest/qmetatype.html
- Q_DECLARE_METATYPE macro documentation: http://doc.trolltech.com/latest/qmetatype.html#Q_DECLARE_METATYPE-15
- qRegisterMetaType function documentation: http://doc.trolltech.com/latest/qmetatype.html#qRegisterMetaType
- "Marshalling Custom Types with Qt 4": http://doc.trolltech.com/qq/qq14-metatypes.html