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

Javascript array operations on QVariantList property do nothing (have fix)

    XMLWordPrintable

Details

    • macOS
    • d2737bdedb6a53f83bab1c1c5606bcfc1df91687

    Description

      The attached test project shows the difference between a QML var property used as a Javascript array:

      property var qmlList: []
      

      and a QVariantList used as a Javascript array:

      Q_PROPERTY(QVariantList list READ list WRITE setList NOTIFY listChanged)
      

      The QML declared list works as expected as a JS array. However, the C++ QVariantList accepts JS array operations (such as push, splice, etc) yet they have no effect.

      I feel this may be related to #QTBUG-28602.

      I noticed that QList properties works with int, bool, etc, so I added support for QVariantList in qv8sequencewrapper. I would have linked to a patch on gerrit, but I was having trouble pushing it successfully. For now, I've attached the patch, I'll have another look at gerrit stuff tomorrow.

      Attachments

        1. qvariantlist_arrayops.patch
          2 kB
          Kit Ham
        2. variantListTest.zip
          18 kB
          Kit Ham

        Issue Links

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

          Activity

            People

              kitizz Kit Ham
              kitizz Kit Ham
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes