Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-113690

Elements of QStringList property are not updatable for QGadgets

    XMLWordPrintable

Details

    • c1600b568 (dev), 937751f42 (dev), 8529d537a (6.6), b9bfdea0e (dev)

    Description

      I believe there is a problematic behaviour in case of creation QGadget based class that holds:

      Q_PROPERTY(QStringList gadgetStringList READ gadgetStringList WRITE setGadgetStringList)

      There is no possibility in QML context to change elements of gadgetStringList by index gadgetStringList[i]:

      Window {
          property myTestGadget gadget
      
          Component.onCompleted: {             
              gadget.gadgetStringList = ["Element1", "Element2", "Element3"]
              obj.qobjectStringList = ["Element1", "Element2", "Element3"]
              console.log("Gadget List: " + gadget.gadgetStringList)
              console.log("Object List: " + obj.qobjectStringList)
              gadget.gadgetStringList[0] = "Completely new Element"
              obj.qobjectStringList[0] = "Completely new Element"
              console.log("Gadget List: " + gadget.gadgetStringList)
              console.log("Object List: " + obj.qobjectStringList)
              gadget.gadgetStringList = ["Element4", "Element5"]
              console.log("Gadget List: " + gadget.gadgetStringList)
           }
      }

      Note: The same functionality for QObgect classes works correctly. 

      obj.qobjectStringList - QObject based list

      gadget.gadgetStringList - QGadget based list{}

       

      Actual result:

      qml: Gadget List: Element1,Element2,Element3
      qml: Object List: Element1,Element2,Element3
      qml: Gadget List: Element1,Element2,Element3
      qml: Object List: Completely new Element,Element2,Element3

      Expected result:

      qml: Gadget List: Element1,Element2,Element3
      qml: Object List: Element1,Element2,Element3
      qml: Gadget List: Completely new Element,Element2,Element3
      qml: Object List: Completely new Element,Element2,Element3

       

      Please, find full code version in attach.

       

      Another important problem for QGadgets: 

      Q_PROPERTY(QByteArrayList gadgetArrayList READ gadgetArrayList WRITE setGadgetArrayList)

      gadget.gadgetArrayList[0] is not recognised in QML

      Note:

      Again for QObjects everything works.

      Attachments

        For Gerrit Dashboard: QTBUG-113690
        # Subject Branch Project Status CR V

        Activity

          People

            ulherman Ulf Hermann
            tatiana.borisova Tatiana Borisova
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes