From: Alan Alpert Date: Fri, 19 Aug 2011 00:32:27 +0000 (+1000) Subject: Fix spacing issue X-Git-Url: http://git.silmor.de/gitweb/?a=commitdiff_plain;h=5deb2f91286834aabbc18e4eb1d5c2805624b64b;p=konrad%2Fqtdeclarative.git Fix spacing issue Spacing was being incorrectly applied in circumstances where invisible items existed at the end of a positioner. Task-number: QTBUG-20961 Change-Id: I49ebc8e96a1564c0ff2bde1c1bb3f91d3c441488 Reviewed-on: http://codereview.qt.nokia.com/3232 Reviewed-by: Qt Sanity Bot Reviewed-by: Michael Brasser --- diff --git a/src/declarative/items/qsgpositioners.cpp b/src/declarative/items/qsgpositioners.cpp index df3450e..fca0aa1 100644 --- a/src/declarative/items/qsgpositioners.cpp +++ b/src/declarative/items/qsgpositioners.cpp @@ -533,10 +533,11 @@ void QSGColumn::doPositioning(QSizeF *contentSize) contentSize->setWidth(qMax(contentSize->width(), child.item->width())); voffset += child.item->height(); - if (ii != positionedItems.count() - 1) - voffset += spacing(); + voffset += spacing(); } + if (voffset != 0)//If we positioned any items, undo the spacing from the last item + voffset -= spacing(); contentSize->setHeight(voffset); } @@ -734,10 +735,11 @@ void QSGRow::doPositioning(QSizeF *contentSize) contentSize->setHeight(qMax(contentSize->height(), child.item->height())); hoffset += child.item->width(); - if (ii != positionedItems.count() - 1) - hoffset += spacing(); + hoffset += spacing(); } + if (hoffset != 0)//If we positioned any items, undo the extra spacing from the last item + hoffset -= spacing(); contentSize->setWidth(hoffset); if (d->isLeftToRight())