From 6c64d1ca6b37c24b8e6f79f02923aeca9de2616d Mon Sep 17 00:00:00 2001 From: =?utf8?q?Rafael=20Fern=C3=A1ndez=20L=C3=B3pez?= Date: Sat, 14 Jul 2007 03:45:42 +0000 Subject: [PATCH] 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 --- src/kcategorizedview.cpp | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) 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()); -- 2.47.3