ListView draws each item on top of each other. What am I doing wrong?
Solved
QML and Qt Quick
-
Below code produces list view as shown in the screenshot. Probably I'm missing something very trivial but I can't figure out what?
import QtQuick 2.0 ListModel { ListElement { flag: "us" name: "USA" strength: "5" } ListElement { flag: "fr" name: "France" strength: "4" } ListElement { flag: "nl" name: "Netherlands" strength: "2" } }
import QtQuick 2.9 import QtQuick.Window 2.2 Window { visible: true width: 640 height: 480 Component { id: countryItem Item { Text { text: name + " " + flag + " " + strength } } } ListView { anchors { fill: parent } model: TestModel{} delegate: countryItem } }