Details
-
Bug
-
Resolution: Done
-
P2: Important
-
5.0.0
-
None
-
52c1d7a994216f0b37ac04a2fea4337bc0c7550b
Description
With the following code, execute this sequence of key presses:
1) Enter (set contentY to 80)
2) Return (insert an item at 0)
3) Space (move with (1,6,3) parameters)
Observe the resulting indexes in view are out of sequence, and there is a gap in the second slot. (Attached as actual.png)
import QtQuick 2.0 Item { width: 600; height: 600 ListView { id: view2 width: 240; height: 320 x: 100 y: 100 model: ListModel { id: model2 Component.onCompleted: { for (var i=0; i<30; i++) { append({'name': 'item ' + i}) } } } delegate: Rectangle { border.width: 1 width: 200; height: 20; Row { Text { text: name + " : " + index + " : " } Text { text: " " + parent.parent.x + ", " + parent.parent.y } } objectName: name } focus: true Keys.onEnterPressed: { contentY = 80 } Keys.onReturnPressed: { model.insert(0, {"name": "new item" }) } Keys.onSpacePressed: { model.move(1, 6, 3) } } Rectangle { anchors.fill: view2 color: "lightsteelblue" opacity: 0.3 } Text { anchors.right: parent.right; text: "content y:" + view2.contentY + ", count: " + model2.count }// + " " + view2.count } }