Details
-
Bug
-
Resolution: Invalid
-
P4: Low
-
None
-
5.15.8, 6.2.4
Description
When referencing a listview's contentItem.children[index] property, if the ListView's dimensions are not concretely defined or not large enough to simultaneously display all the delegates, one of the children will be listed as a QQuickItem regardless of if the actual corresponding delegate is a QQuickItem or not.
import QtQuick import QtQuick.Controls ApplicationWindow { width: 640 height: 480 visible: true title: qsTr("Hello World") ListView { id: testList model: 20 cacheBuffer: 1000 spacing: 2 /*The following results in the 2nd delegate showing up as a QQuickItem in the list of children of the ListView*/ anchors.fill: parent /*The following results in the delegate with the issue not being the 2nd but the first delegate that is not at least partially visible within the defined height of the ListView // height: 400 // width: 400 /*The following results in no issues at all with the list of children*/ // height: 1000 // width: 400 // Component.onCompleted: anchors.fill = parent delegate: Button { width: ListView.view.width height: 30 text: index Component.onCompleted: { console.log("Index " + index + " is listed as a " + testList.contentItem.children[index].toString()) } onClicked: console.log("This is button number " + index + " functioning properly") } } }
See attached file for the full sample project.
Attachments
Issue Links
- relates to
-
QTBUG-104204 Meta-task for issues related to ListView filling a window
- Reported