Details
-
Bug
-
Resolution: Done
-
P2: Important
-
4.7.2
-
None
-
95ddfa13737164c93c58ce3694ce59ec68a016d9
Description
Run the code below. Click anywhere to toggle between the two models. Note that the size of
the list (yellow) changes. Comment out the ListView's "model: listModel1" line and restart.
Click on the screen again and note that contentHeight is not updated (it stays zero and the
height of the listbox is not set correctly).
import Qt 4.7 Item { width: 800 height: 480 ListModel { id: listModel1 ListElement { text: "Apple" } ListElement { text: "Banana" } ListElement { text: "Orange" } ListElement { text: "Coconut" } } ListModel { id: listModel2 ListElement { text: "Bird" } ListElement { text: "Elephant" } ListElement { text: "Seal" } } Rectangle { width: 200 height: listView.contentHeight color: "yellow" anchors.centerIn: parent ListView { id: listView anchors.fill: parent model: listModel1 // Comment me out to show issue delegate: Item { width: 200 height: 20 Text { text: model.text; anchors.centerIn: parent } } } } MouseArea { anchors.fill: parent onClicked: listView.model = (listView.model == listModel1 ? listModel2 : listModel1) } }