on xenial help sign in
Add divider dots.
9f6a37dYing-Chun Liu
qml/Components/PageHeader.qml+24
@@ -35,6 +35,8 @@ Item {
35 property bool searchInProgress: false
35 property bool searchInProgress: false
36
36
37 property alias bottomItem: bottomContainer.children
37 property alias bottomItem: bottomContainer.children
38+ property int dividerDotsCount: 0
39+ property int dividerDotsIndex: -1
38
40
39 // TODO We should use foreground for the icons
41 // TODO We should use foreground for the icons
40 // of the toolbar but unfortunately Action does not have
42 // of the toolbar but unfortunately Action does not have
@@ -277,6 +279,28 @@ Item {
277 }
279 }
278 }
280 }
279
281
282+ Row {
283+ id: dividerDotsRow
284+ objectName: "dividerDotsRow"
285+ spacing: units.gu(.5)
286+ Repeater {
287+ id: dividerDotsRepeater
288+ objectName: "dividerDotsRepeater"
289+ model: root.dividerDotsCount
290+ Image {
291+ objectName: "dividerDots_" + index
292+ height: units.gu(1)
293+ width: height
294+ source: (index == root.dividerDotsIndex) ? "graphics/dot_on.png" : "graphics/dot_off.png"
295+ }
296+ }
297+ anchors {
298+ top: headerContainer.bottom
299+ horizontalCenter: headerContainer.horizontalCenter
300+ topMargin: units.gu(.5)
301+ }
302+ }
303+
280 Component {
304 Component {
281 id: popoverComponent
305 id: popoverComponent
282 Popover {
306 Popover {
qml/Components/graphics/dot_off@30.pngnew file

Binary file not shown.

qml/Components/graphics/dot_on@30.pngnew file

Binary file not shown.

qml/Dash/DashContent.qml+2
@@ -141,6 +141,8 @@ Item {
141 item.scope = Qt.binding(function() { return scope })
141 item.scope = Qt.binding(function() { return scope })
142 item.isCurrent = Qt.binding(function() { return visible && ListView.isCurrentItem })
142 item.isCurrent = Qt.binding(function() { return visible && ListView.isCurrentItem })
143 dashContent.scopeLoaded(item.scope.id)
143 dashContent.scopeLoaded(item.scope.id)
144+ item.dividerDotsCount = Qt.binding(function() { return dashContentList.count } )
145+ item.dividerDotsIndex = Qt.binding(function() { return dashContentList.currentIndex } )
144 }
146 }
145 Connections {
147 Connections {
146 target: isCurrent ? scope : null
148 target: isCurrent ? scope : null
qml/Dash/GenericScopeView.qml+2
@@ -33,6 +33,8 @@ FocusScope {
33 property bool hasBackAction: false
33 property bool hasBackAction: false
34 property bool enableHeightBehaviorOnNextCreation: false
34 property bool enableHeightBehaviorOnNextCreation: false
35 property var categoryView: categoryView
35 property var categoryView: categoryView
36+ property alias dividerDotsCount: pageHeader.dividerDotsCount
37+ property alias dividerDotsIndex: pageHeader.dividerDotsIndex
36
38
37 property var scopeStyle: ScopeStyle {
39 property var scopeStyle: ScopeStyle {
38 style: scope ? scope.customizations : {}
40 style: scope ? scope.customizations : {}
tests/qmltests/Components/tst_PageHeader.qml+21
@@ -175,6 +175,27 @@ Item {
175 ];
175 ];
176 }
176 }
177
177
178+ function test_divider_dots() {
179+ var dividerDotsRepeater = findChild(pageHeader, "dividerDotsRepeater");
180+ tryCompare(dividerDotsRepeater, "count", 0);
181+ pageHeader.dividerDotsCount = 5;
182+ tryCompare(dividerDotsRepeater, "count", 5);
183+ for (var i=0; i<pageHeader.dividerDotsCount; i++) {
184+ pageHeader.dividerDotsIndex = i;
185+ for (var j=0; j<dividerDotsRepeater.count; j++) {
186+ var dividerDot = findChild(pageHeader, "dividerDots_"+j);
187+ if (i==j) {
188+ compare(dividerDot.source.toString().indexOf("dot_on") > -1, true);
189+ } else {
190+ compare(dividerDot.source.toString().indexOf("dot_off") > -1, true);
191+ }
192+ }
193+ }
194+ pageHeader.dividerDotsIndex = -1;
195+ pageHeader.dividerDotsCount = 0;
196+ tryCompare(dividerDotsRepeater, "count", 0);
197+ }
198+
178 function test_tap_outside_closes_popup(data) {
199 function test_tap_outside_closes_popup(data) {
179 searchEnabled = true;
200 searchEnabled = true;
180 pageHeader.searchHistory.clear();
201 pageHeader.searchHistory.clear();