QVariantMap in JS
-
Hi all !
I exposed QVariantMap value to JS@QScriptValue qsvCFG = m_SCEngine->newVariant(vmCFG);
m_SCEngine->globalObject().setProperty("__vmCFG", qsvCFG);@using
@print(__vmCFG);@i see:
@QVariant(QVariantMap)@But, how to work now with this value in JS ?
@__vmCFG["key"]@does not work.....
-
Hi,
You need to pass the QVariantMap value as a argument in a function or as a variable like this:
@ QMetaObject::invokeMethod(obj, "objFunction", Qt::BlockingQueuedConnection, Q_ARG(QVariant, QVariant::fromValue(newMap)));@
@ QObject objToSetVariantMap.setProperty("objProperty", QVariant::fromValue(newMap));@
I hope I have helped you.