On 15 June 2015 at 01:43, Gerhard Scheikl <g.sche...@avibit.com> wrote:
> Hi > > I recently discovered some unexpected behavior when exchanging a > QVariantMap > with QML code: > > Here's what I'm doing on the C++ side: > my_map = json_document.toVariant(); > engine.rootContext()->setContextProperty("myMap", my_map); > > Then on the QML side: > myMap.asdf.name = "asdf" > > This change is not reflected in the original map. > Obviously, accessing asdf.name returns a copy. > > Is this the intended behavior? > If so, how can I ensure that the data in C++ and on the QML side is always > the > same? > (use QJSValue? use a QObject hierarchy with dynamic properties?) > > Thanks! > > var tmp = myMap.asdf; tmp.name = "asdf" myMap.asdf = tmp;
_______________________________________________ Development mailing list Development@qt-project.org http://lists.qt-project.org/mailman/listinfo/development