[Interest] QML ListView anchoring fails

ashish dabhade ashishd157 at gmail.com
Mon Nov 10 11:45:37 CET 2014


Hi All,

Why is it that anchoring (fill) ListView to parent fails in following
example ?

ApplicationWindow {
    id: main
    visible: true
    height: 300
    width: 300

    Rectangle {
        anchors.fill: parent
        ListView {
            anchors.fill: parent
            model: ListModel {
                id: modelData
                ListElement {
                    name: "Bill Smith"
                    number: "555 3264"
                }
                ListElement {
                    name: "John Brown"
                    number: "555 8426"
                }
                ListElement {
                    name: "Sam Wise"
                    number: "555 0473"
                }
            }
            delegate: Rectangle {
                height: 40
                width: 300
                opacity: 0.0
                color: "lightgray"
                Text {
                    anchors.centerIn: parent
                    text: name
                }
            }
            populate: Transition {
                NumberAnimation { property: "opacity"; to: 1.0; duration:
1000 }
            }
        }
    }
}

If ListView or Rectangle is given width or height it works as expected. Is
it a bug or am i missing something ?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20141110/c82d6057/attachment.html>


More information about the Interest mailing list