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

Qt 4.8.6 ListModel.append(jsobject dict) does not work if dict contains multiple items, while Qt 5.5.0 version works.

    XMLWordPrintable

Details

    • Bug
    • Resolution: Invalid
    • Not Evaluated
    • None
    • 4.8.x
    • None

    Description

      Hi Qt Company Team,

      It has been noticed that Qt 4.8.6 ListModel.append(jsobject dict) does not work if dict contains multiple items, while Qt 5.5.0 version works.

      This issue can be reproduced by the following simple QML code:

      ==========
      import QtQuick 1.1
      //import QtQuick 2.0 // for Qt 5

      Item { id: myTopLevelObj
      width: 1280
      height: width * 3 / 5

      ListModel

      { id: newListModel }

      property variant oldListModel: [

      {fruit: "apple"}

      ,

      {fruit: "banana"}

      ]

      onOldListModelChanged: {
      newListModel.clear();

      for(var i = 0; i < oldListModel.length; i++)

      { newListModel.append(oldListModel[i]); }

      // Qt 4: Error: QML ListModel: append: value is not an object
      // Qt 5: no problem.
      newListModel.append(oldListModel);

      // Qt 4: count is 2
      // Qt 5: count is 4
      console.log("newListModel.count[" + newListModel.count + "]");
      }
      }
      ==========

      I would say that the Qt 5.5.0 version works as expected, so the Qt 4.8.6 version needs to be improved. Can this be fixed in a future Qt 4 release? Thanks!

      Attachments

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

        Activity

          People

            aalpert Alan Alpert
            jonathanz Jonathan Zhong
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes