int qRegisterMetaType ( const char * typeName )
Registers the type name typeName to the type T. Returns the internal ID used by QMetaType. Any class or struct that has a public constructor, a public copy constructor, and a public destructor can be registered.
After a type has been registered, you can create and destroy objects of that type dynamically at run-time.
This example registers the class MyClass:
qRegisterMetaType<MyClass>("MyClass");
Note: This function is thread-safe.
See also qRegisterMetaTypeStreamOperators(), QMetaType::isRegistered(), and Q_DECLARE_METATYPE().
void qRegisterMetaTypeStreamOperators ( const char * typeName )
Registers the stream operators for the type T called typeName.
Afterward, the type can be streamed using QMetaType::load() and QMetaType::save(). These functions are used when streaming a QVariant.
qRegisterMetaTypeStreamOperator<MyClass>("MyClass" );
The stream operators should have the following signatures:
QDataStream &operator<<(QDataStream &out, const MyClass &myObj);
QDataStream &operator>>(QDataStream &in, MyClass &myObj);
Note: This function is thread-safe.
See also qRegisterMetaType(), QMetaType::isRegistered(), and Q_DECLARE_METATYPE().
Bookmarks