Rafael Brandao
unread,Jun 15, 2012, 4:47:10 PM6/15/12Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to snowsh...@googlegroups.com
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: NOBODY
---
src/mobile/qml/PageFillGrid.qml | 1 +
src/mobile/qml/TabsPanel.qml | 7 ++++---
2 files changed, 5 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..eab9d4c 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,7 @@ Item {
clip: true
Text {
- text: index + (pagedGrid.currentPage * pagedGrid.itemsPerPage) + 1
+ text: pagedItem.parent.pageOffset + index + 1
color: "#C1C2C3"
font.pixelSize: 30
font.family: "Nokia Pure Headline Light"
@@ -78,7 +79,7 @@ Item {
PagedGrid {
id: pagedGrid
model: TabsModel
- delegate: pagedItemDelegate
+ delegate: pagedItemComponent
emptyItemDelegate: Image { source: "qrc:///mobile/grid/thumb_empty_slot" }
maxPages: indicatorRow.maxItems
anchors {
--
1.7.9.5