~zsombi/ubuntu-ui-toolkit/83-rtl-support

« back to all changes in this revision

Viewing changes to examples/ubuntu-ui-toolkit-gallery/NewListItems.qml

  • Committer: Zsombor Egri
  • Date: 2015-02-25 11:54:57 UTC
  • mfrom: (1352.6.93 82-dragging-mode)
  • Revision ID: zsombor.egri@canonical.com-20150225115457-sf0p7yjxbcvkzedt
prereq sync

Show diffs side-by-side

added added

removed removed

Lines of Context:
34
34
        // clip the action delegates while swiping left/right
35
35
        clip: true
36
36
 
37
 
        ListView {
38
 
            height: units.gu(20)
39
 
            width: parent.width
40
 
 
41
 
            model: [ i18n.tr("Basic"), i18n.tr("Colored divider"), i18n.tr("No divider") ]
42
 
            delegate: ListItemWithLabel {
43
 
                text: modelData
44
 
                divider {
45
 
                    colorFrom: modelData == i18n.tr("Colored divider") ? UbuntuColors.red : Qt.rgba(0.0, 0.0, 0.0, 0.0)
46
 
                    colorTo: modelData == i18n.tr("Colored divider") ? UbuntuColors.green : Qt.rgba(0.0, 0.0, 0.0, 0.0)
47
 
                    visible: modelData != i18n.tr("No divider")
48
 
                }
49
 
            }
50
 
        }
51
 
     }
52
 
 
53
 
    TemplateSection {
54
 
        className: "ListItem"
55
 
        // no spacing between the list items in the Column
56
 
        spacing: 0
57
 
        Item {
58
 
            // compensate for the spacing of 0 by adding this
59
 
            // Item inbetween the title and the list items.
60
 
            height: units.gu(3)
61
 
            width: parent.width
62
 
        }
63
 
 
64
 
        // clip the action delegates while swiping left/right
65
 
        clip: true
66
 
 
67
37
       ListItemWithLabel {
68
38
            color: UbuntuColors.blue
69
39
            text: i18n.tr("Colored")
155
125
            }
156
126
        }
157
127
    }
 
128
 
 
129
    TemplateSection {
 
130
        className: "ListItem"
 
131
        title: "Select mode"
 
132
 
 
133
        ListView {
 
134
            height: units.gu(20)
 
135
            width: parent.width
 
136
            clip: true
 
137
 
 
138
            model: [ i18n.tr("Basic"), i18n.tr("Colored divider"), i18n.tr("No divider") ]
 
139
            delegate: ListItemWithLabel {
 
140
                text: modelData
 
141
                divider {
 
142
                    colorFrom: modelData == i18n.tr("Colored divider") ? UbuntuColors.red : Qt.rgba(0.0, 0.0, 0.0, 0.0)
 
143
                    colorTo: modelData == i18n.tr("Colored divider") ? UbuntuColors.green : Qt.rgba(0.0, 0.0, 0.0, 0.0)
 
144
                    visible: modelData != i18n.tr("No divider")
 
145
                }
 
146
            }
 
147
        }
 
148
    }
 
149
 
 
150
    TemplateSection {
 
151
        className: "ListItem"
 
152
        title: "Drag mode"
 
153
 
 
154
        ListView {
 
155
            height: units.gu(20)
 
156
            width: parent.width
 
157
            clip: true
 
158
            ViewItems.dragMode: true
 
159
            ViewItems.onDragUpdated: {
 
160
                if (event.status == ListItemDrag.Moving) {
 
161
                    model.move(event.from, event.to, 1)
 
162
                }
 
163
            }
 
164
 
 
165
            model: ListModel {
 
166
                ListElement { label: "Basic" }
 
167
                ListElement { label: "Colored divider" }
 
168
                ListElement { label: "No divider" }
 
169
            }
 
170
 
 
171
            delegate: ListItemWithLabel {
 
172
                text: modelData
 
173
                color: dragMode ? "lightblue" : "lightgray"
 
174
                divider {
 
175
                    colorFrom: modelData == i18n.tr("Colored divider") ? UbuntuColors.red : Qt.rgba(0.0, 0.0, 0.0, 0.0)
 
176
                    colorTo: modelData == i18n.tr("Colored divider") ? UbuntuColors.green : Qt.rgba(0.0, 0.0, 0.0, 0.0)
 
177
                    visible: modelData != i18n.tr("No divider")
 
178
                }
 
179
            }
 
180
        }
 
181
    }
158
182
}