I know, it’s possible to define a QObject with custom properties and expose this object in QML environment. But this way, for each new property I’d need to recompile C++ code.
Is it possible, to make a dynamic binding from C++/Qt to QML-objects?
Something like:
//C++ code:
updateProperty("myQmlObject.any_property", "Hello World");
Thank you!
SOLVED:
_view->rootContext()->setContextProperty( "cppmessage" , "Hello from C++" );
WHERE: view is a QDeclarativeView, and cppmessage is used in QML without prior declaration like: “text: cppmessage”
This link was usefull for finding the solution: http://xizhizhu.blogspot.com/2010/10/hybrid-application-using-qml-and-qt-c.html
Yes, This can be done. Link
Edit:1
Another way to do it , as suggested by @Valentin is listed here
link