]> cloud.milkyroute.net Git - dolphin.git/commitdiff
If we have different heights on the same row, make it possible to update taller items...
authorRafael Fernández López <ereslibre@kde.org>
Sat, 14 Jul 2007 04:01:58 +0000 (04:01 +0000)
committerRafael Fernández López <ereslibre@kde.org>
Sat, 14 Jul 2007 04:01:58 +0000 (04:01 +0000)
svn path=/trunk/KDE/kdebase/apps/; revision=687625

src/kcategorizedview.cpp

index 3255de9a49b3db3d8838942b0a1cf8241534590b..cc83e2de9633c5a38eaf8049794ffd81923e8963 100644 (file)
@@ -98,6 +98,17 @@ const QModelIndexList &KCategorizedView::Private::intersectionSet(const QRect &r
 
     intersectedIndexes.clear();
 
+    int itemHeight;
+
+    if (listView->gridSize().isEmpty())
+    {
+        itemHeight = biggestItemSize.height();
+    }
+    else
+    {
+        itemHeight = listView->gridSize().height();
+    }
+
     // Lets find out where we should start
     int top = proxyModel->rowCount() - 1;
     int bottom = 0;
@@ -108,10 +119,13 @@ const QModelIndexList &KCategorizedView::Private::intersectionSet(const QRect &r
 
         index = elementDictionary[proxyModel->index(middle, 0)];
         indexVisualRect = visualRect(index);
+        // We need the whole height (not only the visualRect). This will help us to update
+        // all needed indexes correctly (ereslibre)
+        indexVisualRect.setHeight(indexVisualRect.height() + (itemHeight - indexVisualRect.height()));
 
         if (qMax(indexVisualRect.topLeft().y(),
                  indexVisualRect.bottomRight().y()) < qMin(rect.topLeft().y(),
-                                                        rect.bottomRight().y()))
+                                                           rect.bottomRight().y()))
         {
             bottom = middle + 1;
         }