summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMarius Bugge Monsen <mmonsen@trolltech.com>2009-06-09 14:22:05 +0200
committerMarius Bugge Monsen <mmonsen@trolltech.com>2009-06-09 14:22:05 +0200
commit44e2f85be9f20019363f50bf0d59d70799cc6fcb (patch)
tree7077f3d0c73e760d41e7a2c86a62050d3528a819 /src
parentf1bc6d4f5f1a7f403ad407ad446aada89d2d59b1 (diff)
Fix bug in QtGraphicsListView::setOffsetToEnsureIndexIsVisible(int). Instead of translating the view geometry to fit the item coordinate space, calcuate everything in view space. Auto-test on the way.
Diffstat (limited to 'src')
-rw-r--r--src/qgraphicslistview.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/qgraphicslistview.cpp b/src/qgraphicslistview.cpp
index a082b71..8a5e1b5 100644
--- a/src/qgraphicslistview.cpp
+++ b/src/qgraphicslistview.cpp
@@ -1023,16 +1023,16 @@ void QtGraphicsListView::setOffsetToEnsureIndexIsVisible(int index)
Q_D(QtGraphicsListView);
const QPointF offset(d->horizontalOffset, d->verticalOffset);
const QRectF item = itemGeometry(index); // potentially slow
- const QRectF view = geometry().translated(-offset);
+ const QRectF view = geometry();
if (!view.contains(item)) {
if (item.top() < view.top())
- setVerticalOffset(item.top() + offset.y());
+ setVerticalOffset(offset.y() + item.top());
else if (item.bottom() > view.bottom())
- setVerticalOffset(item.bottom() - view.height() + offset.y());
+ setVerticalOffset(offset.y() + item.bottom() - view.height());
if (item.left() < view.left())
- setHorizontalOffset(item.x() + offset.x());
+ setHorizontalOffset(offset.x() + item.x());
else if (item.right() > view.right())
- setHorizontalOffset(item.right() - view.width() + offset.x());
+ setHorizontalOffset(offset.x() + item.right() - view.width());
}
}
@@ -1259,6 +1259,7 @@ QtGraphicsListViewItemCreatorBase *QtGraphicsListView::itemCreator() const
/*!
Sets the given item \a creator on the view.
+ The view will take ownership of the creator.
*/
void QtGraphicsListView::setItemCreator(QtGraphicsListViewItemCreatorBase *creator)
{