summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarius Bugge Monsen <mmonsen@trolltech.com>2009-06-08 14:00:52 +0200
committerMarius Bugge Monsen <mmonsen@trolltech.com>2009-06-08 14:00:52 +0200
commitd4c2f53b2a109ebee7fc684e81a270592b348c3d (patch)
treeebbfc3293a3a3db7bacdd034b4b4dfb92c43c08b
parent6af57ca44869a4e57a278ddf11ade7cec9d6f2ac (diff)
Even if QtGraphicsListView has a visible item, we still may have to change the offset in setOffsetToEnsureIndexIsVisible(int).
-rw-r--r--src/qgraphicslistview.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/qgraphicslistview.cpp b/src/qgraphicslistview.cpp
index 38f495b..0ffd73b 100644
--- a/src/qgraphicslistview.cpp
+++ b/src/qgraphicslistview.cpp
@@ -632,6 +632,9 @@ QtGraphicsListView::~QtGraphicsListView()
Returns the geometry given to the item
referred to by the given \a index.
+ Note that this function is potentially slow
+ for non-visible items.
+
\sa updateLayout()
*/
QRectF QtGraphicsListView::itemGeometry(int index) const
@@ -1005,8 +1008,6 @@ int QtGraphicsListView::firstIndex() const
void QtGraphicsListView::setOffsetToEnsureIndexIsVisible(int index)
{
Q_D(QtGraphicsListView);
- if (itemForIndex(index))
- return; // the item was already visible
const QRectF geometry = itemGeometry(index); // ### potentially slow
if (d->orientation == Qt::Vertical)
setVerticalOffset(geometry.y() + d->verticalOffset); // ### FIXME: not always correct