diff options
author | Marcelo Lira <marcelo.lira@openbossa.org> | 2012-06-04 17:11:25 -0300 |
---|---|---|
committer | Marcelo Lira <marcelo.lira@openbossa.org> | 2012-06-04 17:51:11 -0300 |
commit | fda49066dca29bf9388cafb313d9960a48b60656 (patch) | |
tree | 070b5f36b4c12c8d260d1cdd70ad50f68dd81b0a | |
parent | deb0c472023043669d1daf9cf8d4a0a0b7123462 (diff) |
Shows correctly aligned empty slots when paged grid is empty.
Before this fix an empty paged grid would show empty slots to the
left, as if it was a previous empty page, and the slots in the
central page would appear slightly unaligned.
Reviewed-by: Rafael Brandão
-rw-r--r-- | src/mobile/qml/PageFillGrid.qml | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/mobile/qml/PageFillGrid.qml b/src/mobile/qml/PageFillGrid.qml index bb262cb..046dba3 100644 --- a/src/mobile/qml/PageFillGrid.qml +++ b/src/mobile/qml/PageFillGrid.qml @@ -35,6 +35,7 @@ Item { property int itemsPerPage: rowsPerPage * columnsPerPage property int pageWidth: columnsPerPage * itemWidth + (columnsPerPage - 1) * spacing property int pageHeight: rowsPerPage * itemHeight + (rowsPerPage - 1) * spacing + property bool isEmpty: pageCount === 0 function itemAt(index) { var pageForIndex = Math.floor(index / grid.itemsPerPage), offset = index % grid.itemsPerPage; @@ -46,6 +47,7 @@ Item { } Grid { + visible: !isEmpty spacing: root.spacing rows: root.rowsPerPage @@ -100,7 +102,7 @@ Item { anchors { top: pages.top left: pages.right - leftMargin: root.spacing + leftMargin: isEmpty ? 0 : root.spacing } Repeater { model: itemsPerPage |