lundi 25 janvier 2016

retrieve QMetaType from QMetaObject

I have a recursive function that is traversing Qt plugin's metadata. It's straightforward to get QMetaObject from QMetaType, but I could not find anything that will let me obtain QMetaType from QMetaObject. Please take a look at the example below:

QPluginLoader pluginLoader(pluginPath);
const QMetaObject *pMetaObject = pluginInstance->metaObject();
//how do I get the metatype? in the meantime as I move forward
auto metaMethod = pMetaObject->method(pMetaObject->methodOffset());//QMetaMethod
int returnType = metaMethod.returnType();
auto qMetaType = QMetaType(returnType);//QMetaType for custom class obtained

Both my plugin's entry class, and the other custom class that my method returns are registered with qRegisterMetaType().

Aucun commentaire:

Enregistrer un commentaire