Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. QJSValue instead of QVariantMap when passing javascript object from QML to C++

QJSValue instead of QVariantMap when passing javascript object from QML to C++

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
1 Posts 1 Posters 221 Views
  • 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.
  • P Offline
    P Offline
    Pieter Cardoen
    wrote on 1 Feb 2023, 11:18 last edited by
    #1

    Dear

    In QML, I have:

    onClicked : {
                            var data = {} // javascript object
                            // code to fill the data object
                            // the setData function is to QAbstractItemModel::setData
                            __root.model.setData(currentIndex,data,SparkplugTreeModel.Value);
                        }
    

    In C++ I get a QVariant which is automatically converted but type is "QMetaType::User". The value I got from QML has type "QJSValue".

    Why is this automagically converted to QJSValue and not to QVariantMap as expected?

    Thanks
    Pieter

    1 Reply Last reply
    0

    1/1

    1 Feb 2023, 11:18

    • Login

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