summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAndras Becsi <andras.becsi@theqtcompany.com>2015-08-04 13:51:51 +0200
committerAndras Becsi <andras.becsi@theqtcompany.com>2015-08-12 17:22:03 +0200
commitaee0d02368ebd2e5b7e80399667c42e16940c747 (patch)
tree4f3a77ecd61f478bfb207e9acf116ede6b3da9fa /src
parent5ae767f13550ac93c2265312d716d414dbd48321 (diff)
Replace static page indicators with Repeater and delegate
This way the maximum number of bookmarks can be changed by updating the gridViewMaxBookmarks constant.
Diffstat (limited to 'src')
-rw-r--r--src/qml/HomeScreen.qml52
1 files changed, 17 insertions, 35 deletions
diff --git a/src/qml/HomeScreen.qml b/src/qml/HomeScreen.qml
index 39e216e..4e62040 100644
--- a/src/qml/HomeScreen.qml
+++ b/src/qml/HomeScreen.qml
@@ -423,42 +423,24 @@ Rectangle {
bottom: parent.bottom
horizontalCenter: parent.horizontalCenter
}
- Rectangle {
- property bool active: gridView.contentX < gridView.page
- width: 10
- height: width
- radius: width / 2
- color: !active ? inactivePagerColor : uiColor
- anchors.verticalCenter: parent.verticalCenter
- MouseArea {
- anchors.fill: parent
- onClicked: gridView.contentX = 0
- }
- }
- Rectangle {
- property bool active: gridView.page <= gridView.contentX && gridView.contentX < 2 * gridView.page
- width: 10
- visible: gridView.count > 8
- height: width
- radius: width / 2
- color: !active ? inactivePagerColor : uiColor
- anchors.verticalCenter: parent.verticalCenter
- MouseArea {
- anchors.fill: parent
- onClicked: gridView.contentX = gridView.page
+ Repeater {
+ model: {
+ var c = gridView.count % gridViewPageItemCount
+ if (c > 0)
+ c = 1
+ return Math.floor(gridView.count / gridViewPageItemCount) + c
}
- }
- Rectangle {
- property bool active: 2 * gridView.page <= gridView.contentX
- width: 10
- visible: gridView.count > 16
- height: width
- radius: width / 2
- color: !active ? inactivePagerColor : uiColor
- anchors.verticalCenter: parent.verticalCenter
- MouseArea {
- anchors.fill: parent
- onClicked: gridView.contentX = 2 * gridView.page
+ delegate: Rectangle {
+ property bool active: index * gridView.page <= gridView.contentX && gridView.contentX < (index + 1) * gridView.page
+ width: 10
+ height: width
+ radius: width / 2
+ color: !active ? inactivePagerColor : uiColor
+ anchors.verticalCenter: parent.verticalCenter
+ MouseArea {
+ anchors.fill: parent
+ onClicked: gridView.contentX = index * gridView.page
+ }
}
}
}