Re: [Development] QVariantMap <-> QML

2015-06-26 Thread Gerhard Scheikl
Hausmann Simon , 14.06.2015 17:57: > Hi, > > This is a result of QVariant being a value type. If you make a copy and > modify it, then the original remains as-is. The call to setContextProperty > creates a copy. If you want explicitly shared data between the JavaScript > environment and C++ then I

Re: [Development] QVariantMap <-> QML

2015-06-14 Thread Hausmann Simon
- accessed from C++ as QJSValue, because those are explicitly shared. Simon Original Message From: Gerhard Scheikl Sent: Sunday, June 14, 2015 19:43 To: development@qt-project.org Subject: [Development] QVariantMap <-> QML Hi I recently discovered some unexpected behavior when exchan

Re: [Development] QVariantMap <-> QML

2015-06-14 Thread Gerhard Scheikl
Ben Lau , 15.06.2015 01:45: > var tmp = myMap.asdf; > tmp.name = "asdf" > myMap.asdf = tmp; Thanks for the fast reply! Unfortunately, this approach is very cumbersome for deeper hierarchies like: a.b.c.d[2].e.f = "g" I was hoping for a more convenient solution. Best regards Gerhard

Re: [Development] QVariantMap <-> QML

2015-06-14 Thread Ben Lau
On 15 June 2015 at 01:43, Gerhard Scheikl 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); >

[Development] QVariantMap <-> QML

2015-06-14 Thread Gerhard Scheikl
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