Details
-
Suggestion
-
Resolution: Won't Do
-
P4: Low
-
None
-
5.4.0, 5.15.7, 6.2.1
-
Mac Yosemite and Linux CentOS 7
Description
Item { id: rootitem width: list.contentWidth height: list.contentHeight ListView { id: list anchors.fill: parent model: 4 delegate: Text { // Could be any Item. Even with hardcoded width/height it doesn't work. text: index } Component.onCompleted: console.log("ch: " + contentHeight + " cw: " + contentWidth) } }
I'm trying to set up an item that wraps around my contents. Using the listview contentHeight works great, but contentWidth never gets set... I've burned countless hours trying to mess with implicitWidth to no avail. All examples I've seen online always use a hard-coded root width. Maybe there's an implementation strategy I'm missing here, but I cannot for the life of me get my root item to automatically wrap around the size of my contents, and the contentWidth never being set affects this (looks like it comes down to childrenRect never having a width).
The closest related issue I can find to this is QTBUG-35063.
I forgot to add my hack of a workaround, which I'd prefer not to use...
delegate: Text { text: index Component.onCompleted: rootitem.width = (rootitem.width < width ? width : rootitem.width) }
Attachments
Issue Links
- relates to
-
QTBUG-82290 ListView should set implicitWidth to the max of its delegates' widths
- Reported