Hi Simon, thank you very much for the explanation. No need for bug hunting then.
On Thu, Sep 25, 2014 at 7:55 AM, Simon Hausmann <[email protected]> wrote: > We've changed this in Qt 5.4 slightly: When > converting a JavaScript object back to a QVariant, we won't try to "destroy" > it but instead we'll give you a QVariant that holds a (strong) reference to > the JavaScript object, it'll be a QJSValue in a QVariant. Note how somebody > could call setMap with the return value of buildMap() but also with a JS > object literal: setMap( { x: ["a", "b" ] }) > > QVariant(QVariantMap, QMap(("x", QVariant(QStringList, ("a", "b")) ) ) ) > > You can do the conversion like this: > > QVariant map = ... > if (map.userType() == qMetaTypeId<QJSValue>()) > map = qvariant_cast<QJSValue>(map).toVariant(); I think this should be added to the documentation. Maybe here: http://doc-snapshot.qt-project.org/qt5-5.4/qtqml-cppintegration-data.html. I'd give it a try if this is the right place. This is very important to know especially if you use Qml only as glue to directly bind C++ objects properties. I wasn't aware that this also involves two (in this use case unwanted) conversions (C++ -> JS -> C++). Nils _______________________________________________ Development mailing list [email protected] http://lists.qt-project.org/mailman/listinfo/development
