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: "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!