-
Bug
-
Resolution: Out of scope
-
Not Evaluated
-
None
-
4.7.3
-
None
-
Ubuntu 10.04 (64 bit)
When the first item in a ListView is removed as in the example below, the real contentY property value gets increased by #removedItems * (itemHeight + spacing).
import QtQuick 1.0
ListView {
id: listView
height: 300; width: 200
spacing: 5
model: ListModel {
id: listModel
ListElement { }
ListElement { }
ListElement { }
ListElement { }
ListElement { }
ListElement { }
}
delegate: Rectangle {
height: 90
width: listView.width
color: "#5D91DB"
Text {
anchors.centerIn: parent
text: model.index
}
}
Component.onCompleted: {
// bug occurs only if first item is removed
listModel.remove(0)
// listModel.remove(0)
}
// (contentY - correctContentY) ≈ #removedItems * (itemHeight + spacing)
property int correctContentY: Math.ceil(visibleArea.yPosition * contentHeight)
onContentYChanged:
console.log("contentY: " + contentY +
", correctContentY: " + correctContentY +
" (difference: " + (contentY - correctContentY) + ")\n" +
"visibleArea.yPosition: " + visibleArea.yPosition +
", atYBeginning: " + atYBeginning +
", atYEnd: " + atYEnd + "\n")
}
(Scroll ListView to get debug output)
- relates to
-
QTBUG-64219 [REG 5.5.1->5.6.0] Removing and adding rows breaks ListView content positioning
-
- Reported
-