┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRafael Fernández López <[email protected]>2007-07-14 03:45:42 +0000
committerRafael Fernández López <[email protected]>2007-07-14 03:45:42 +0000
commit6c64d1ca6b37c24b8e6f79f02923aeca9de2616d (patch)
tree7cd71f4a75a5bfd30a4d03e731ff6d407a559bfc
parent185d839d29b3c6838f25c0d99ac650fea8356398 (diff)
Follow QListView behavior. Each item has the exact size to fit its contents. Not bigger for little elements.
CCMAIL: [email protected] svn path=/trunk/KDE/kdebase/apps/; revision=687624
-rw-r--r--src/kcategorizedview.cpp15
1 files 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());