Important: Please read the Qt Code of Conduct -

QVariantMap in JS

  • Hi all !
    I exposed QVariantMap value to JS

    @QScriptValue qsvCFG = m_SCEngine->newVariant(vmCFG);
    m_SCEngine->globalObject().setProperty("__vmCFG", qsvCFG);@


    i see:

    But, how to work now with this value in JS ?

    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.

Log in to reply