Details
-
Bug
-
Resolution: Unresolved
-
P5: Not important
-
None
-
5.0.1, 5.0.2
-
None
Description
Try this code:
import QtQuick 1.1 Rectangle { width: 360 height: 360 Text { id: contenty; objectName: "contenty"; text: lv.contentY; anchors.top: parent.top } ListView { id: lv anchors.fill: parent anchors.bottomMargin: 30; anchors.topMargin: 30; spacing: 5 clip: true; model: msgmodel delegate: Rectangle { id: rect; width: lv.width; height: txt.height; Text { id: txt; width: 150; anchors.top: parent.top; anchors.topMargin: 5; //wrapMode: Text.WrapAtWordBoundaryOrAnywhere; text: lv.contentHeight + " " + msgtext; } } } Text { id: btn; objectName: "btn"; signal add(); text: "Click to move at end" anchors.bottom: parent.bottom MouseArea { anchors.fill: parent onReleased: lv.positionViewAtEnd(); } } }
If you use data that generate delegate items with same height it will work ok. But if you have text with different resulting height, every time when positionViewAtEnd() is called it will decrease (or in some cases increase) contentY to negative value when view is on top. I`ve also noticed if I use delegate items with same height but word wrap is enabled, same thing happens.
In QtQuick 2.0 behavior is better - it only increases contentY on positionViewAtEnd when view is at the beginning. Case with word wrap is working well.
Attachments
Issue Links
- relates to
-
QTBUG-22894 Incorrect ListView.contentY when its elements have different height
- Closed