Ubuntu Pastebin

Paste from jgdx at Wed, 18 Nov 2015 14:37:45 +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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
import QtQuick 2.4
import Ubuntu.Components 1.3

Column {
    width: 500
    height: 500

    Component {
        id: listcomp
        ListItem {
            property alias title: layout.title
            height: layout.height + divider.height
            ListItemLayout {
                id: layout

                Icon {
                    width: units.gu(4.5)
                    height: width
                    name: "distributor-logo"
                    SlotsLayout.position: SlotsLayout.First
                }
            }
        }
    }

    ListItem{
        height: l.height + divider.height
        SlotsLayout {
            id: l
            Button {
                text: "Add item"
                onClicked: rep.model = rep.model + 1
            }
        }
    }

    Repeater {
        id: rep
        model: 1
        delegate: Item {
            anchors { left: parent ? parent.left : undefined; right: parent ? parent.right : undefined; }
            visible: height > 0
            height: loader.height
            Loader {
                id: loader
                asynchronous: true
                sourceComponent: listcomp
                anchors { left: parent ? parent.left : undefined; right: parent ? parent.right : undefined; }
                onLoaded: item.title.text = 'Item %1'.arg(index)
            }
        }
    }
}
Download as text