]> cloud.milkyroute.net Git - dolphin.git/commitdiff
Follow QListView behavior. Each item has the exact size to fit its contents. Not...
authorRafael Fernández López <ereslibre@kde.org>
Sat, 14 Jul 2007 03:45:42 +0000 (03:45 +0000)
committerRafael Fernández López <ereslibre@kde.org>
Sat, 14 Jul 2007 03:45:42 +0000 (03:45 +0000)
CCMAIL: peter.penz@gmx.at

svn path=/trunk/KDE/kdebase/apps/; revision=687624

src/kcategorizedview.cpp

index 5a395b767d4d1bd6b3869300c27e2f0caa783914..3255de9a49b3db3d8838942b0a1cf8241534590b 100644 (file)
@@ -198,7 +198,16 @@ QRect KCategorizedView::Private::visualRectInViewport(const QModelIndex &index)
                    row * itemHeight);
 
     retRect.setWidth(itemWidth);
-    retRect.setHeight(itemHeight);
+
+    if (listView->gridSize().isEmpty())
+    {
+        retRect.setHeight(listView->sizeHintForIndex(proxyModel->mapFromSource(index)).height());
+    }
+    else
+    {
+        retRect.setHeight(qMin(listView->sizeHintForIndex(proxyModel->mapFromSource(index)).height(),
+                               listView->gridSize().height()));
+    }
 
     return retRect;
 }
@@ -347,8 +356,8 @@ void KCategorizedView::Private::drawNewCategory(const QModelIndex &index,
 
 void KCategorizedView::Private::updateScrollbars()
 {
-    int lastItemBottom = cachedRectIndex(lastIndex).bottom() +
-                           listView->spacing() - listView->viewport()->height();
+    int lastItemBottom = cachedRectIndex(lastIndex).top() +
+                         listView->spacing() + (listView->gridSize().isEmpty() ? 0 : listView->gridSize().height()) - listView->viewport()->height();
 
     listView->verticalScrollBar()->setSingleStep(listView->viewport()->height() / 10);
     listView->verticalScrollBar()->setPageStep(listView->viewport()->height());