Details
-
Bug
-
Resolution: Duplicate
-
P2: Important
-
5.15.3
Description
When some property, say x, has a binding with Listview's height and ListView height has binding with its parent height, x is not calculated as expected.
Please refer to the attached sample, you can see that delegateHeight has a binding with ListViews's height and is then used to calculate preferredHighlightBegin/End. But due to wrong calculations, some other index(other than currentIndex) is highlighted.
ListView { id: listview //It works with those 2 lines instead of anchors.fill: parent // width: 640 // height: 351 anchors.fill: parent property real heightRatio: 0.20 property int delegateHeight: heightRatio * height .... preferredHighlightBegin: (height-delegateHeight)/2 preferredHighlightEnd: (height+delegateHeight)/2 // It works if delegateHeight is not used //preferredHighlightBegin: (height-(height*heightRatio))/2 //preferredHighlightEnd: (height+(height*heightRatio))/2 .. }
Attachments
Issue Links
- duplicates
-
QTBUG-39146 Setting ListView currentIndex doesn't set initial item correctly in certain circumstances
- Closed