Hi
Some QObject derived Classes in my Application are created and destroyed dynamicly during runtime.
Those Objects are "injected" into QML be using setContextProperty:
SomeObject* someObjectInstance = new SomeObject();
view.rootContext()->setContextProperty("someObjectInstance", someObjectInstance);
SomeObject* someObjectInstance = new SomeObject();
view.rootContext()->setContextProperty("someObjectInstance", someObjectInstance);
To copy to clipboard, switch view to plain text mode
view is a QDeclarativeView here.
Well, basically this works. But it takes a lot of time and sometimes the Application even crashes. It seems like all bindings of the Context are reevaluate when i add a new Context Property.
So i think im doing something completely wrong here. Is there a way to achieve the desired dynamic binding, without all binding having to reevaluate? I searched the web and did read the Documentation, but didnt seem to find anything when it comes to more advanced interaction between QML and C++.
What happens to the binding if a QObject that was exported using QDeclarativeContext::setContextProperty is destoyed? will the Binding still be there?
Bookmarks