~ci-train-bot/ubuntu-settings-components/ubuntu-settings-components-ubuntu-zesty-2236

« back to all changes in this revision

Viewing changes to examples/Printers.qml

  • Committer: Jonas G. Drange
  • Date: 2017-01-10 16:01:10 UTC
  • mto: (176.8.2 quality-read-write)
  • mto: This revision was merged to the branch mainline in revision 183.
  • Revision ID: jonas.drange@canonical.com-20170110160110-kykhdqr4bochneth
working end to end

Show diffs side-by-side

added added

removed removed

Lines of Context:
28
28
    width: units.gu(50)
29
29
    height: units.gu(90)
30
30
 
 
31
    PrinterModel {
 
32
        id: printerModel
 
33
    }
 
34
 
31
35
    PageStack {
32
36
        id: pageStack
33
37
 
38
42
            visible: false
39
43
 
40
44
            Column {
 
45
                spacing: units.gu(2)
41
46
                anchors { left: parent.left; right: parent.right }
42
47
 
43
48
                Label {
 
49
                    anchors { left: parent.left; right: parent.right }
44
50
                    text: "Printers"
45
51
                }
46
52
 
47
53
                ListView {
48
 
                    model:
 
54
                    anchors { left: parent.left; right: parent.right }
 
55
                    model: printerModel
49
56
                    delegate: ListItem {
50
57
                        // shall specify the height when Using ListItemLayout inside ListItem
51
58
                        height: modelLayout.height + (divider.visible ? divider.height : 0)
52
59
                        ListItemLayout {
53
60
                            id: modelLayout
54
 
                            title.text: modelData
 
61
                            title.text: displayName
 
62
                            subtitle.text: description
 
63
 
 
64
                            Button {
 
65
                                property string newInfo: description === "my description" ? "your description" : "my description"
 
66
                                text: "Change info to " + newInfo
 
67
                                onClicked: description = newInfo
 
68
                            }
 
69
                        }
55
70
                    }
56
71
                }
57
72
            }