Details
-
Suggestion
-
Resolution: Done
-
Not Evaluated
-
None
-
None
-
None
Description
Coming from C++/QML and using Q_PROPERTY macro on my classes, I'm a bit confused about the use of properties to share data between Python class and QML.
Here ( https://doc.qt.io/qtforpython/PySide6/QtCore/Property.html ) you describe the Property function but I can't find a complete description of parameters in API doc. And a complete QML demo project should be nice.
But here ( https://doc.qt.io/qtforpython/tutorials/portingguide/index.html ) you talk about the @property decorator as alternative to Q_PROPERTY, but again no complete example or documentation.
So at the moment I don't know what is the best way to go to use propertie in QML; Here what I would to do:
- using prop value in QML (text: myclass.myvar) and update text every time myvar is set
- assigning value from QML using{{ myclass.myvar = value}}, without using slot call
In this case a QML frontend will be independent from the backend (python/C++)