Always position headers at a negative position
authorBea Lam <bea.lam@nokia.com>
Thu, 14 Jul 2011 03:55:20 +0000 (13:55 +1000)
committerQt by Nokia <qt-info@nokia.com>
Thu, 21 Jul 2011 04:23:11 +0000 (06:23 +0200)
commitc0fc795feb06a8e2f813690e47b2cb981c67546c
tree6d4b20b85d140bb55599ac55a2c0c37fa4aa0853
parent6b8e98aec3f382fedea704691da40376cbe88e5e
Always position headers at a negative position

Previously headers were either positioned at 0 if there were no items in
the view, or at (0 - headerSize) if items were present. With this fix
they are always positioned at (0 - headerSize) to be consistent.

Due to the change, setPosition(-headerSize()) is now called from
componentCompleted() to ensure the header is visible.

This change also fixes GridView's header and footer positioning in
TopToBottom + RightToLeft mode.

Also added extra tests for header and footer positioning and fixed
incorrect test value in tst_QSGGridView::positionViewAtIndex() (was 460
instead of 430 because previously rowPosAt() always added the header
size, so if positionViewAtIndex() jumped past all visible items and
caused them to be released, the new items started at +headerSize()
instead of 0).

Change-Id: I1015bed457d4ae964a7fb13702e2dfc470a168a9
Reviewed-on: http://codereview.qt.nokia.com/1618
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Martin Jones <martin.jones@nokia.com>
src/declarative/items/qsggridview.cpp
src/declarative/items/qsgitemview.cpp
src/declarative/items/qsgitemview_p_p.h
src/declarative/items/qsglistview.cpp
tests/auto/declarative/qsggridview/data/footer.qml
tests/auto/declarative/qsggridview/data/header.qml
tests/auto/declarative/qsggridview/tst_qsggridview.cpp
tests/auto/declarative/qsglistview/data/footer.qml
tests/auto/declarative/qsglistview/data/header.qml
tests/auto/declarative/qsglistview/data/headerfooter.qml
tests/auto/declarative/qsglistview/tst_qsglistview.cpp