How to convert QVariant(CustomType *) to CustomType*
-
Im passing a map object into QML by using ;
@viever.rootContext()->setContextProperty(.. , ..)@My map object is ;
@QMap<QString, QVariant> map;
map.insert("KEY", QVariant::fromValue(CustomTypeList*))@In QML im getting @QVariant(CustomTypeList*)@ by MyMapObject["KEY"]. It is the model for my repeater. It is ok but i have to reach an invokable method (insert Method) in order to manupulate this model object. My question is that how can i reach CustomType's methods from QVariant(CustomType*)?
or any other suggestion?
-
@
QVariant variant = QVariant::fromValue(CustomTypeList *object);
CustomTypeList *myVariable = variant.value<CustomTypeList *>();
@ -
AFAIK, JavaScript will not understand your custom type, so it cannot convert.