mapFromModel() returned incorrect value
authorBea Lam <bea.lam@nokia.com>
Wed, 24 Aug 2011 06:47:35 +0000 (16:47 +1000)
committerQt by Nokia <qt-info@nokia.com>
Wed, 24 Aug 2011 08:11:29 +0000 (10:11 +0200)
It should not add visibleIndex to the returned value.
(regression from 9b5f9c8056186c9cf3c40dbac66e5f90369339dc when ListView
and GridView implementations were merged). GridView used to do this and
so did ListView at one point but the ListView implementation was
changed.

Change-Id: I94c02034580506d4b431126f1b857977e401c27a
Reviewed-on: http://codereview.qt.nokia.com/3450
Reviewed-by: Bea Lam <bea.lam@nokia.com>
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
src/declarative/items/qsgitemview.cpp

index bf5d190..5543f12 100644 (file)
@@ -1098,7 +1098,7 @@ int QSGItemViewPrivate::mapFromModel(int modelIndex) const
     for (int i = 0; i < visibleItems.count(); ++i) {
         FxViewItem *item = visibleItems.at(i);
         if (item->index == modelIndex)
-            return i + visibleIndex;
+            return i;
         if (item->index > modelIndex)
             return -1;
     }