How can we make the ListView in height equal to the size of all model elements so that in the literal sense there is no scrolling, but a complete display of all elements as in the case of Repeater? PS: I came to this solution without finding the section parameter I needed in Repeater.

  • Clarify the question. Throw off at least some source code. You can take screenshots of the Android emulator and show them what is wrong (for example, in Paint). - nick

1 answer 1

in ListView, you need to set the height so height: contentItem.height

 Rectangle { border.color: "red" border.width: 1 width: childrenRect.width + 10 height: childrenRect.height + 10 ListView { x: 5 y: 5 width: 220 height: contentItem.height model: idModel spacing: 10 delegate: Rectangle { color: "yellow" width: 100 height: 80 Text { anchors.centerIn: parent text: model.name } } } } ListModel{ id: idModel ListElement { name: "item 1" } ListElement { name: "item 2" } ListElement { name: "item 3" } } 

Stroke in red for clarity Stroke in red for clarity