]> cloud.milkyroute.net Git - dolphin.git/commitdiff
Even better behavior when different possibilities, grid or not grid, spacing or not...
authorRafael Fernández López <ereslibre@kde.org>
Sat, 14 Jul 2007 14:20:54 +0000 (14:20 +0000)
committerRafael Fernández López <ereslibre@kde.org>
Sat, 14 Jul 2007 14:20:54 +0000 (14:20 +0000)
svn path=/trunk/KDE/kdebase/apps/; revision=687849

src/kcategorizedview.cpp

index cc83e2de9633c5a38eaf8049794ffd81923e8963..97045f3830c4200037792ee6d37341b3d4844051 100644 (file)
@@ -201,15 +201,32 @@ QRect KCategorizedView::Private::visualRectInViewport(const QModelIndex &index)
 
         if (rows - trunc(rows)) rowsInt++;
 
-        retRect.setTop(retRect.top() +
-                       (rowsInt * listView->spacing()) +
-                       (rowsInt * itemHeight) +
-                       itemCategorizer->categoryHeight(listView->viewOptions()) +
-                       listView->spacing() * 2);
+        if (listView->gridSize().isEmpty())
+        {
+            retRect.setTop(retRect.top() +
+                           (rowsInt * listView->spacing()) +
+                           (rowsInt * itemHeight) +
+                           itemCategorizer->categoryHeight(listView->viewOptions()) +
+                           listView->spacing() * 2);
+        }
+        else
+        {
+            retRect.setTop(retRect.top() +
+                           (rowsInt * itemHeight) +
+                           itemCategorizer->categoryHeight(listView->viewOptions()));
+        }
     }
 
-    retRect.setTop(retRect.top() + row * listView->spacing() +
-                   row * itemHeight);
+
+    if (listView->gridSize().isEmpty())
+    {
+        retRect.setTop(retRect.top() + row * listView->spacing() +
+                       (row * itemHeight));
+    }
+    else
+    {
+        retRect.setTop(retRect.top() + (row * itemHeight));
+    }
 
     retRect.setWidth(itemWidth);
 
@@ -272,11 +289,20 @@ QRect KCategorizedView::Private::visualCategoryRectInViewport(const QString &cat
 
         if (rows - trunc(rows)) rowsInt++;
 
-        retRect.setTop(retRect.top() +
-                       (rowsInt * listView->spacing()) +
-                       (rowsInt * itemHeight) +
-                       itemCategorizer->categoryHeight(listView->viewOptions()) +
-                       listView->spacing() * 2);
+        if (listView->gridSize().isEmpty())
+        {
+            retRect.setTop(retRect.top() +
+                           (rowsInt * listView->spacing()) +
+                           (rowsInt * itemHeight) +
+                           itemCategorizer->categoryHeight(listView->viewOptions()) +
+                           listView->spacing() * 2);
+        }
+        else
+        {
+            retRect.setTop(retRect.top() +
+                           (rowsInt * itemHeight) +
+                           itemCategorizer->categoryHeight(listView->viewOptions()));
+        }
     }
 
     retRect.setHeight(itemCategorizer->categoryHeight(listView->viewOptions()));