diff options
| author | Rafael Fernández López <[email protected]> | 2007-07-14 03:04:24 +0000 |
|---|---|---|
| committer | Rafael Fernández López <[email protected]> | 2007-07-14 03:04:24 +0000 |
| commit | 185d839d29b3c6838f25c0d99ac650fea8356398 (patch) | |
| tree | 3f905cf6991a41aa06e2c226b212861f3bdb0468 | |
| parent | 5c36011cf1f2fb65f59a9f3410240146c1cb0a44 (diff) | |
Respect grid sizes.
CCMAIL: [email protected]
svn path=/trunk/KDE/kdebase/apps/; revision=687616
| -rw-r--r-- | src/kcategorizedview.cpp | 44 |
1 files changed, 39 insertions, 5 deletions
diff --git a/src/kcategorizedview.cpp b/src/kcategorizedview.cpp index 622fe7b60..5a395b767 100644 --- a/src/kcategorizedview.cpp +++ b/src/kcategorizedview.cpp @@ -151,8 +151,20 @@ QRect KCategorizedView::Private::visualRectInViewport(const QModelIndex &index) int viewportWidth = listView->viewport()->width() - listView->spacing(); - int itemHeight = biggestItemSize.height(); - int itemWidth = biggestItemSize.width(); + int itemHeight; + int itemWidth; + + if (listView->gridSize().isEmpty()) + { + itemHeight = biggestItemSize.height(); + itemWidth = biggestItemSize.width(); + } + else + { + itemHeight = listView->gridSize().height(); + itemWidth = listView->gridSize().width(); + } + int itemWidthPlusSeparation = listView->spacing() + itemWidth; int elementsPerRow = viewportWidth / itemWidthPlusSeparation; if (!elementsPerRow) @@ -206,8 +218,20 @@ QRect KCategorizedView::Private::visualCategoryRectInViewport(const QString &cat int viewportWidth = listView->viewport()->width() - listView->spacing(); - int itemHeight = biggestItemSize.height(); - int itemWidth = biggestItemSize.width(); + int itemHeight; + int itemWidth; + + if (listView->gridSize().isEmpty()) + { + itemHeight = biggestItemSize.height(); + itemWidth = biggestItemSize.width(); + } + else + { + itemHeight = listView->gridSize().height(); + itemWidth = listView->gridSize().width(); + } + int itemWidthPlusSeparation = listView->spacing() + itemWidth; int elementsPerRow = viewportWidth / itemWidthPlusSeparation; @@ -937,7 +961,17 @@ QModelIndex KCategorizedView::moveCursor(CursorAction cursorAction, const QModelIndex current = selectionModel()->currentIndex(); int viewportWidth = viewport()->width() - spacing(); - int itemWidth = d->biggestItemSize.width(); + int itemWidth; + + if (gridSize().isEmpty()) + { + itemWidth = d->biggestItemSize.width(); + } + else + { + itemWidth = gridSize().width(); + } + int itemWidthPlusSeparation = spacing() + itemWidth; int elementsPerRow = viewportWidth / itemWidthPlusSeparation; |
