[Development] Best-practice data type to pass JSON data between C++ and QML

Knoll Lars Lars.Knoll at digia.com
Wed Aug 7 21:22:39 CEST 2013

Right now, they are probably the best you can get. Let's see if we can do
something better in the future.

On 8/7/13 5:17 PM, "Milian Wolff" <mail at milianw.de> wrote:

>Hey there!
>What data type is the most efficient to pass JSON data between C++ and
>QML? Is 
>there one which does not incur any conversions at all? I tried with
>QVariantMap and QJsonObject, both work more or less equally well I think.
>both the best you can get?
>I'm interested in both ways btw., i.e.:
>Item {
>  function foo() {
>    for(var i in myObj.data) {
>      console.log(i, myObj.data[i]);
>    }
>    myObj.data = {foo: "bar", asdf: 42.0};
>typedef JSONData ?;
>class MyObj : public QObject {
>  Q_PROPERTY(data READ data WRITE setData NOTIFY dataChanged)
>  JSONData data() const;
>  void setData(const JSONData& data) const;
>  void dataChanged(JSONData);
>Milian Wolff
>mail at milianw.de
>Development mailing list
>Development at qt-project.org

More information about the Development mailing list