Details
-
Bug
-
Resolution: Done
-
P3: Somewhat important
-
4.7.3
-
None
Description
For the following code:
import QtQuick 2.0 Item { width: 500; height: 500 ListView { id: view2 width: 300; height: 300 y: 100 model: ListModel { id: model2 Component.onCompleted: { for (var i=0; i<30; i++) { append({'name': 'item ' + i}) } } } delegate: Rectangle { width: 100; height: 20; border.width: 0 Text { text: name + ": " + parent.y } } Component.onCompleted: { //view2.contentY = 80 } } focus: true Keys.onEnterPressed: view2.contentY = 80 Keys.onReturnPressed: model2.move(0, 4, 1) Rectangle { anchors.fill: view2 border.width: 1 color: "transparent" } }
Press 'Enter' to change the content y and then 'Return' to move 0 -> 4.
The first 3 items are:
item 3: 80
item 4: 100
item 0: 120
when they should instead be:
item 4: 80
item 0: 100
item 5: 120
The problem doesn't occur if the contentY is set in ListView Component.onCompleted instead of the key press event.