on xenial help sign in
Make it a list, it's better and will allow us to do the animations better
799f27bAlbert Astals
qml/Dash/ScopesListCategory.qml+53−51
@@ -22,7 +22,7 @@ import "../Components/ListItems" as ListItems
22Item {
22Item {
23 id: root
23 id: root
24
24
25− property alias model: repeater.model
25+ property alias model: list.model
26 property var scopeStyle
26 property var scopeStyle
27 property bool isFavoriteFeeds: false
27 property bool isFavoriteFeeds: false
28
28
@@ -42,60 +42,62 @@ Item {
42 property var myComponents: JSON.parse('{"art":{"aspect-ratio":1,"field":"art"},"title":{"field":"title"},"attributes":{}}')
42 property var myComponents: JSON.parse('{"art":{"aspect-ratio":1,"field":"art"},"title":{"field":"title"},"attributes":{}}')
43
43
44
44
45− Column {
45+ ListView {
46− anchors.top: header.bottom
46+ id: list
47− Repeater {
47+ height: contentHeight
48− id: repeater
48+ interactive: false
49
49
50+ anchors.top: header.bottom
50− delegate: Loader {
51+ delegate: Loader {
51− asynchronous: true
52+ asynchronous: true
53+ width: root.width
54+ height: units.gu(6)
55+ sourceComponent: Item {
56+ height: units.gu(6)
52 width: root.width
57 width: root.width
53− sourceComponent: Item {
54− height: units.gu(6)
55− UbuntuShape {
58+ UbuntuShape {
56− id: shape
59+ id: shape
57− anchors {
60+ anchors {
58− left: parent.left
61+ left: parent.left
59− leftMargin: units.gu(1)
62+ leftMargin: units.gu(1)
60− verticalCenter: parent.verticalCenter
63+ verticalCenter: parent.verticalCenter
61− }
64+ }
62− width: units.gu(5)
65+ width: units.gu(5)
63− height: units.gu(5)
66+ height: units.gu(5)
64− image: Image {
67+ image: Image {
65− source: model["art"] || ""
68+ source: model["art"] || ""
66− cache: true
69+ cache: true
67− fillMode: Image.PreserveAspectCrop
70+ fillMode: Image.PreserveAspectCrop
68− }
69 }
71 }
72+ }
70− Label {
73+ Label {
71− id: titleLabel
74+ id: titleLabel
72− anchors {
75+ anchors {
73− left: shape.right
76+ left: shape.right
74− leftMargin: units.gu(1)
77+ leftMargin: units.gu(1)
75− right: star.right
78+ right: star.right
76− rightMargin: units.gu(1)
79+ rightMargin: units.gu(1)
77− verticalCenter: parent.verticalCenter
80+ verticalCenter: parent.verticalCenter
78− }
81+ }
79− text: model["title"] || ""
82+ text: model["title"] || ""
80− elide: Text.ElideRight
83+ elide: Text.ElideRight
81− wrapMode: Text.Wrap
84+ wrapMode: Text.Wrap
82− maximumLineCount: 1
85+ maximumLineCount: 1
83− verticalAlignment: Text.AlignHCenter
86+ verticalAlignment: Text.AlignHCenter
87+ }
88+ Icon {
89+ id: star
90+ anchors {
91+ right: parent.right
92+ rightMargin: units.gu(1)
93+ verticalCenter: parent.verticalCenter
84 }
94 }
85− Icon {
86− id: star
87− anchors {
88− right: parent.right
89− rightMargin: units.gu(1)
90− verticalCenter: parent.verticalCenter
91− }
92− height: units.gu(2)
95+ height: units.gu(2)
93− width: units.gu(2)
96+ width: units.gu(2)
94− source: isFavoriteFeeds ? "image://theme/starred" : "image://theme/non-starred"
97+ source: isFavoriteFeeds ? "image://theme/starred" : "image://theme/non-starred"
95− MouseArea {
98+ MouseArea {
96− anchors.fill: parent
99+ anchors.fill: parent
97− onClicked: root.requestFavorite(model.scopeId, !isFavoriteFeeds);
100+ onClicked: root.requestFavorite(model.scopeId, !isFavoriteFeeds);
98− }
99 }
101 }
100 }
102 }
101 }
103 }