import QtQuick 2.0
import Ubuntu.Components 1.2
MainView {
applicationName: "tester.zub"
width: units.gu(100)
height: units.gu(75)
Page {
title: "Tester"
Column {
spacing: units.gu(1)
anchors {
margins: units.gu(2)
fill: parent
}
ListModel {
id: model
ListElement { name: "foo" }
ListElement { name: "bar" }
ListElement { name: "baz" }
}
Label {
text: "Label:"
}
ListView { // http://doc.qt.io/qt-5/qml-qtquick-listview.html
model: model
header: Label {
text: "HEADER"
}
footer: Label {
text: "FOOTER"
}
delegate: ListItem {
Label {
text: name
}
Component.onCompleted: console.log("Created item idx " + index + " [name=" + name + "]")
}
Component.onCompleted: console.log("List items: " + model.count)
}
}
}
}