summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafael Brandao <rafael.lobo@openbossa.org>2012-06-15 17:43:29 -0300
committerRafael Brandao <rafael.lobo@openbossa.org>2012-06-15 18:02:47 -0300
commit37a12d8fc1ad93f022c9743c13769da3ddd1162a (patch)
tree795054eb451099eba2e72e5d6e9ae5b4f4068576
parent4f365a2007ab52b244a951a5570fde7a3d265cfa (diff)
Enumerate tabs correctly
As we use Repeater for each page, we get an index in the range from zero to the number of items per page minus one for each component. By adding the offset to the immediate parent, it becomes accessible inside the delegate and then we can add the current page offset expected. Reviewed-by: Caio Oliveira
-rw-r--r--src/mobile/qml/PageFillGrid.qml1
-rw-r--r--src/mobile/qml/TabsPanel.qml9
2 files changed, 7 insertions, 3 deletions
diff --git a/src/mobile/qml/PageFillGrid.qml b/src/mobile/qml/PageFillGrid.qml
index 249df56..74e4c42 100644
--- a/src/mobile/qml/PageFillGrid.qml
+++ b/src/mobile/qml/PageFillGrid.qml
@@ -71,6 +71,7 @@ Item {
Grid {
property alias thumbs: thumbRepeater
+ property int pageOffset: index * itemsPerPage
width: pageWidth
height: pageHeight
spacing: root.spacing
diff --git a/src/mobile/qml/TabsPanel.qml b/src/mobile/qml/TabsPanel.qml
index d8c04dd..5b34cc8 100644
--- a/src/mobile/qml/TabsPanel.qml
+++ b/src/mobile/qml/TabsPanel.qml
@@ -34,8 +34,9 @@ Item {
}
Component {
- id: pagedItemDelegate
+ id: pagedItemComponent
Image {
+ id: pagedItem
property string url: model.url
source: model.thumbnail
height: UiConstants.PagedGridSizeTable[1]
@@ -44,7 +45,9 @@ Item {
clip: true
Text {
- text: index + (pagedGrid.currentPage * pagedGrid.itemsPerPage) + 1
+ // FIXME: We should expose a property like index to PageFillGrid's delegate rather than
+ // depending on PageFillGrid internal structure as we retrieve parent's attribute.
+ text: pagedItem.parent.pageOffset + index + 1
color: "#C1C2C3"
font.pixelSize: 30
font.family: "Nokia Pure Headline Light"
@@ -78,7 +81,7 @@ Item {
PagedGrid {
id: pagedGrid
model: TabsModel
- delegate: pagedItemDelegate
+ delegate: pagedItemComponent
emptyItemDelegate: Image { source: "qrc:///mobile/grid/thumb_empty_slot" }
maxPages: indicatorRow.maxItems
anchors {