Hello all,

Someone sent me his problem with ListView's childrenRect. Essentially, binding 
the ListView's height to the childrenRect.height when using a regular ListModel 
(with strings) will only show the first element while using the XmlListModel 
will fit all the model's items.

Here is his code snippet:
    ListView {
        id: list

        interactive: false
        //height: contentHeight //If bound to contentHeight warning is given 
that there is a binding loop!
        height: childrenRect.height //If bound to childrenRect.height then only 
one item is shown (unless you use an XMLListModel!)
        //contentHeight: childrenRect.height //Not really necessary
        width: parent.width
        model: listModel
        //model: xmlListModel //If the XMLListModel is used, then the 
childrenrect binding is fine
        delegate: listItem
    }
}

What would be the best way of fitting the contents of any/all types of models?

Cheers,
Jerome P.

_______________________________________________
Qt-qml mailing list
Qt-qml@trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-qml

Reply via email to