on xenial help sign in
remove the leftMargin/rightMargin of the Standard item
ccfe104handsome_feng
qml/Dash/DashNavigationList.qml+6−53
@@ -59,13 +59,9 @@ Item {
59 id: column
59 id: column
60 width: parent.width
60 width: parent.width
61
61
62− // TODO: check if SDK ListItems could be used here
62+ ListItem.Standard {
63− // and if not make them be useful since this is a quite common pattern
64−
65− AbstractButton {
66 id: backButton
63 id: backButton
67 objectName: "backButton"
64 objectName: "backButton"
68− width: parent.width
69 visible: navigation && !navigation.isRoot || false
65 visible: navigation && !navigation.isRoot || false
70 height: itemHeight
66 height: itemHeight
71
67
@@ -98,25 +94,11 @@ Item {
98 maximumLineCount: 2
94 maximumLineCount: 2
99 elide: Text.ElideMiddle
95 elide: Text.ElideMiddle
100 }
96 }
101−
102− Rectangle {
103− anchors {
104− bottom: parent.bottom
105− left: parent.left
106− right: parent.right
107− leftMargin: units.gu(2)
108− rightMargin: units.gu(2)
109− }
110− color: root.foregroundColor
111− opacity: 0.2
112− height: units.dp(1)
113− }
114 }
97 }
115
98
116− AbstractButton {
99+ ListItem.Standard {
117 id: allButton
100 id: allButton
118 objectName: "allButton"
101 objectName: "allButton"
119− width: parent.width
120 visible: navigation && (!navigation.isRoot || (!navigation.hidden && root.currentNavigation && !root.currentNavigation.isRoot && root.currentNavigation.parentNavigationId == navigation.navigationId)) || false
102 visible: navigation && (!navigation.isRoot || (!navigation.hidden && root.currentNavigation && !root.currentNavigation.isRoot && root.currentNavigation.parentNavigationId == navigation.navigationId)) || false
121 height: itemHeight
103 height: itemHeight
122
104
@@ -136,19 +118,6 @@ Item {
136 elide: Text.ElideMiddle
118 elide: Text.ElideMiddle
137 }
119 }
138
120
139− Rectangle {
140− anchors {
141− bottom: parent.bottom
142− left: parent.left
143− right: parent.right
144− leftMargin: units.gu(2)
145− rightMargin: units.gu(2)
146− }
147− color: root.foregroundColor
148− opacity: 0.2
149− height: units.dp(1)
150− }
151−
152 onClicked: root.allNavigationClicked();
121 onClicked: root.allNavigationClicked();
153 }
122 }
154
123
@@ -158,13 +127,7 @@ Item {
158 delegate: ListItem.Standard {
127 delegate: ListItem.Standard {
159 objectName: root.objectName + "child" + index
128 objectName: root.objectName + "child" + index
160 height: root.itemHeight
129 height: root.itemHeight
161− anchors {
162− left: parent.left
163− right: parent.right
164− leftMargin: units.gu(2)
165− rightMargin: units.gu(2)
166− }
167− showDivider: false
130+ showDivider: index != navigation.count - 1
168 selected: isActive
131 selected: isActive
169
132
170 onClicked: root.enterNavigation(navigationId, hasChildren)
133 onClicked: root.enterNavigation(navigationId, hasChildren)
@@ -173,8 +136,9 @@ Item {
173 anchors {
136 anchors {
174 verticalCenter: parent.verticalCenter
137 verticalCenter: parent.verticalCenter
175 left: parent.left
138 left: parent.left
139+ leftMargin: units.gu(2)
176 right: rightIcon.visible ? rightIcon.left : parent.right
140 right: rightIcon.visible ? rightIcon.left : parent.right
177− rightMargin: rightIcon.visible ? units.gu(0.5) : 0
141+ rightMargin: rightIcon.visible ? units.gu(0.5) : units.gu(2)
178 }
142 }
179 text: label
143 text: label
180 color: root.foregroundColor
144 color: root.foregroundColor
@@ -188,6 +152,7 @@ Item {
188 anchors {
152 anchors {
189 verticalCenter: parent.verticalCenter
153 verticalCenter: parent.verticalCenter
190 right: parent.right
154 right: parent.right
155+ rightMargin: units.gu(2)
191 }
156 }
192 height: units.gu(2)
157 height: units.gu(2)
193 width: height
158 width: height
@@ -195,18 +160,6 @@ Item {
195 color: root.foregroundColor
160 color: root.foregroundColor
196 visible: hasChildren || isActive
161 visible: hasChildren || isActive
197 }
162 }
198−
199− Rectangle {
200− anchors {
201− bottom: parent.bottom
202− left: parent.left
203− right: parent.right
204− }
205− color: root.foregroundColor
206− opacity: 0.1
207− height: units.dp(1)
208− visible: index != navigation.count - 1
209− }
210 }
163 }
211 }
164 }
212 }
165 }