Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QVariantMap in JS

QVariantMap in JS

Scheduled Pinned Locked Moved General and Desktop
2 Posts 2 Posters 1.0k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • F Offline
    F Offline
    fas.ysk
    wrote on last edited by
    #1

    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.....

    1 Reply Last reply
    0
    • L Offline
      L Offline
      leonardo.ramosantos
      wrote on last edited by
      #2

      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.

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved