Details
-
Bug
-
Resolution: Fixed
-
P4: Low
-
5.15.2, 5.15.6, 6.2.0
-
37c25c6e7 (dev), 8fae0aa4a (6.5)
Description
If Listview has a delegate with height binding to ListView, it creates all the delegate instances in the start and then delete them to keep only required ones.
Please refer to the attached sample.
ListView { id: listView anchors.fill: parent onHeightChanged: console.log("ListView height changed to:", height) model: listModel delegate: Rectangle { width: listView.width / 2 height: listView.height border.width: 1 radius: 10 Text { anchors.centerIn: parent text: name } Component.onCompleted: console.log("onCompleted:", ListView.view, index) Component.onDestruction: console.log("onDestruction:", ListView.view, index) } }
If Model has 7 items, the output is
qml: onCompleted: QQuickListView(0x27e9478f000) 0 qml: onCompleted: QQuickListView(0x27e9478f000) 1 qml: onCompleted: QQuickListView(0x27e9478f000) 2 qml: onCompleted: QQuickListView(0x27e9478f000) 3 qml: onCompleted: QQuickListView(0x27e9478f000) 4 qml: onCompleted: QQuickListView(0x27e9478f000) 5 qml: onCompleted: QQuickListView(0x27e9478f000) 6 qml: ListView height changed to: 480 qml: onDestruction: QQuickListView(0x27e9478f000) 6 qml: onDestruction: QQuickListView(0x27e9478f000) 5 qml: onDestruction: QQuickListView(0x27e9478f000) 4 qml: onDestruction: QQuickListView(0x27e9478f000) 3 qml: onDestruction: QQuickListView(0x27e9478f000) 2
Attachments
Issue Links
- depends on
-
QTBUG-75109 tst_QQuickListView::currentIndex() is failing
- Closed
- relates to
-
QTBUG-104204 Meta-task for issues related to ListView filling a window
- Reported
For Gerrit Dashboard: QTBUG-89568 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
416041,16 | ListView: fix delegates being created unnecessarily | dev | qt/qtdeclarative | Status: NEW | -1 | 0 |