From fda49066dca29bf9388cafb313d9960a48b60656 Mon Sep 17 00:00:00 2001 From: Marcelo Lira Date: Mon, 4 Jun 2012 17:11:25 -0300 Subject: Shows correctly aligned empty slots when paged grid is empty. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- src/mobile/qml/PageFillGrid.qml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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 -- cgit v1.2.3