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

Lists of Strings are not updated or exposed properly

    XMLWordPrintable

Details

    • Windows

    Description

      My Example is based on QQmlApplicationEngine, but is likely encounterable in other spaces too.

      I'm trying to have a list of strings that is synced between QML and Python space.

      If I use

      QQmlApplicationEngine.rootContext().setContextProperty(name, prop)
      

      with prop being a python List[str] (typing module notation) then any changes from QML do not reach python and any changes from Python do not reach QML.

      The same happens with

      QStringListModel

      QStringList is not available, so could not try.

      Workarounds:

      • QStringListModel.setStringList(List[str]) does trigger an update of the model to QML.
      • from QML one can call Add and Remove functions on a bridging QObject

      Attachments

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

        Activity

          People

            crmaurei Cristian Maureira-Fredes
            berserker berserker
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes