From: Rafael Fernández López Date: Sat, 14 Jul 2007 03:45:42 +0000 (+0000) Subject: Follow QListView behavior. Each item has the exact size to fit its contents. Not... X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/commitdiff_plain/6c64d1ca6b37c24b8e6f79f02923aeca9de2616d Follow QListView behavior. Each item has the exact size to fit its contents. Not bigger for little elements. CCMAIL: peter.penz@gmx.at svn path=/trunk/KDE/kdebase/apps/; revision=687624 --- diff --git a/src/kcategorizedview.cpp b/src/kcategorizedview.cpp index 5a395b767..3255de9a4 100644 --- a/src/kcategorizedview.cpp +++ b/src/kcategorizedview.cpp @@ -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());