Ubuntu Pastebin

Paste from DanChapman at Sun, 13 Mar 2016 19:26:59 +0000

Download as text
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
Page {
    title: i18n.tr("ListViewExample")
    
    ListModel {
        id: model
        // add List Elements
        ListElement {
            title: "Some title text"
            subtitle: "Sub title text"
            preview: "Some extra text as a final property"
        }
        
        Component.onCompleted: {
            // append another
            model.append({
                             title: "Some title text",
                             subtitle: "Sub title text",
                             preview: "Some extra text as a final property"
                         })
        }
    }
    
    ListView {
        id: listView
        anchors.fill: parent
        model: model
        delegate: ListItem {
            id: listItem
            height: layout.implicitHeight
            ListItemLayout {
                id: layout
                title.text: model.title
                subtitle.text: model.subtitle
                summary.text: model.preview
            }
        }
    }
}
Download as text