On Sep 23, 2013, at 6:12 PM, Matt Broadstone <[email protected]> wrote:
> On Fri, Sep 20, 2013 at 9:57 AM, Matt Broadstone <[email protected]> wrote: > Hi, > I'm running into a strange error related to context properties in qml. > Basically, I'm trying to expose a QQmlPropertyMap into the context of my > QQmlApplicationEngine, and within the qml set up a "recursive" binding so > that changes to that map from C++ are expressed in qml, and vica versa. This > was not difficult to achieve, however, I keep getting ReferenceErrors stating > that the context property is not defined (even though setting singleshot > timer to change the map indeed reflects a change in the qml scene), not to > mention a slightly less annoying (but annoying nonetheless) warning that I've > set up a recursive binding. I'm wondering if this is a bug, or if I'm just > doing something wrong. > > I have a very simple example of what I'm trying to do posted on these two > pastebins, if someone has a second to take a look that'd be great: > > (c++) http://pastebin.com/S7XeYHEG > (qml) http://pastebin.com/THsPsVkM > > > Any follow up on this from the qml guys? Should I be targeting a qml specific > ML? Hi Matt, Set the context property first, and then load the QML and it should work: QQmlApplicationEngine engine; QQmlContext *ctxt = engine.rootContext(); ctxt->setContextProperty("testData", object.propertyMap()); engine.load(QUrl::fromLocalFile("main.qml")); -- J-P Nurmi _______________________________________________ Development mailing list [email protected] http://lists.qt-project.org/mailman/listinfo/development
