Uploaded image for project: 'Qt for Python'
  1. Qt for Python
  2. PYSIDE-1513

Improve documentation for Property use in QML

    XMLWordPrintable

Details

    • Suggestion
    • Resolution: Done
    • Not Evaluated
    • None
    • None
    • Documentation
    • 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++)

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            ctismer Christian Tismer
            ivant Ivan Tarozzi
            Votes:
            1 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes