I am working on a GUI project with PySide (Qt) and planned to keep all backend/model code in python. This looked easy enough with normal Qt Widgets since it is easy to save a reference to the widget and then update properties as necessary. However I then saw QtQuick and have started to go that direction. The problem that I am having is that I can not seem to figure out how to access QML elements from Python. For example lets say I have a QML file with just a Text
element and I want to update that on some frequency. How would I gain access to the Text
element to be able to set the text
property? What is the standard way to accomplish this?
UPDATE - The marked answer is essentially what I am using with some additions. Not long before the answer was posted I found the reference page that explained all options (http://qt-project.org/doc/qt-4.8/qtbinding.html). The approach I am taking is to setup a class with a property that I want to be updated in the QML element, pass the object to setContextProperty(), reference the object.property in QML then be sure that a notify signal is setup so any change to the object will be reflected in QML. I'll post my code later so others can see it for future reference.