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

variant property wrapper behaves like an array, but fails for splice or delete

    XMLWordPrintable

Details

    Description

      I can not change the contents of an array using splice or delete.

      See following example or attached file:

      import QtQuick 1.0

      Item {
      width: 100; height: 100

      property variant array: ["0", "1", "2"]

      Component.onCompleted:

      { //var array = ["0", "1", "2"] // Outputs ["0","1","2"] console.log(JSON.stringify(array)) var ret = array.splice(1, 1); // Should be ["0","2"] ["1"] but is ["0","1","2"] ["1"] console.log(JSON.stringify(array), JSON.stringify(ret)) delete array[1]; // Should be ["0",null] but is ["0","1","2"] console.log(JSON.stringify(array)) }

      }

      Attachments

        1. SpliceBug.qml
          0.5 kB
          Henrik Hinrichs

        Issue Links

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

          Activity

            People

              martjone Martin Jones (closed Nokia identity) (Inactive)
              hhinrich Henrik Hinrichs
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes