Communication between C++ and QML
-
For example you can emit signal from cpp, cennect to it in qml via Connection and do there whatever you want. Or you can change property of your object (but to do it you need to find it in objects tree).
-
One way is this:
You create a QObject derived class, that you give a property for the image URL, and make sure that property has a proper notify signal. Then, you put an instance of that class as a property in your QDeclarativeContext using setContextProperty. That makes the object accessible from within QML, where you can simply bind against the property name for the image URL.
-
Take a look at this "thread":http://developer.qt.nokia.com/forums/viewthread/4491/#30571 and get a checkout of the code from subversion that I made. This demonstrates exactly what you need.