summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMartin Jones <martin.jones@nokia.com>2010-11-15 07:35:12 (GMT)
committerMartin Jones <martin.jones@nokia.com>2010-11-15 07:35:12 (GMT)
commit153991a45647755c0186f985da255caa09444ff4 (patch)
tree09d486e4a12b20b4891d7e71951bbfb2a0f754eb /src
parentcb25091049daf3f94445c6165d924f49f94325ab (diff)
downloadQt-153991a45647755c0186f985da255caa09444ff4.zip
Qt-153991a45647755c0186f985da255caa09444ff4.tar.gz
Qt-153991a45647755c0186f985da255caa09444ff4.tar.bz2
ListView: items with size < 1.0 were layed out incorrectly.
If the size of an item was less than one its endPosition() was less than its position(), which caused incorrect layout (overlapping items). Task-number: QTBUG-15242 Reviewed-by: Yann Bodson
Diffstat (limited to 'src')
-rw-r--r--src/declarative/graphicsitems/qdeclarativelistview.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/declarative/graphicsitems/qdeclarativelistview.cpp b/src/declarative/graphicsitems/qdeclarativelistview.cpp
index c7b027d..6be49ba 100644
--- a/src/declarative/graphicsitems/qdeclarativelistview.cpp
+++ b/src/declarative/graphicsitems/qdeclarativelistview.cpp
@@ -124,8 +124,8 @@ public:
}
qreal endPosition() const {
return (view->orientation() == QDeclarativeListView::Vertical
- ? item->y() + (item->height() > 0 ? item->height() : 1)
- : item->x() + (item->width() > 0 ? item->width() : 1)) - 1;
+ ? item->y() + (item->height() >= 1.0 ? item->height() : 1)
+ : item->x() + (item->width() >= 1.0 ? item->width() : 1)) - 1;
}
void setPosition(qreal pos) {
if (view->orientation() == QDeclarativeListView::Vertical) {
@@ -736,7 +736,7 @@ void QDeclarativeListViewPrivate::layout()
}
if (!visibleItems.isEmpty()) {
qreal oldEnd = visibleItems.last()->endPosition();
- qreal pos = visibleItems.first()->endPosition() + spacing + 1;
+ qreal pos = visibleItems.first()->position() + visibleItems.first()->size() + spacing;
for (int i=1; i < visibleItems.count(); ++i) {
FxListItem *item = visibleItems.at(i);
item->setPosition(pos);