QML ListView shows only first element of ListModel

Viewed 357

I am learning QML and I have some problems. I want to show all the data in ListModel but ListView shows only the first element. I use code below:

    ListModel{
        id: list

        ListElement{
            name: "Raj"
        }
        ListElement{
            name: "Govard"
        }
        ListElement{
            name: "Leonard"
        }
        ListElement{
            name: "Sheldon"
        }
    }

    ListView{
        id: listView
        clip: false
        width: parent.width
        anchors.top: parent.top
        anchors.topMargin: 0
        model: list
        focus: true
        delegate: Text{
            text: "name: " + name
        }
    }
0 Answers
Related