diff options
| author | Rafael Fernández López <[email protected]> | 2007-07-14 14:20:54 +0000 |
|---|---|---|
| committer | Rafael Fernández López <[email protected]> | 2007-07-14 14:20:54 +0000 |
| commit | 6d858cd70f4adb08757fb24e69d9cc3a3a713390 (patch) | |
| tree | 00ac911cf81d553e6e4db43c9b41bd13f00665e6 /src | |
| parent | 194ce9fe183688544b8b9f420abe7ed186404908 (diff) | |
Even better behavior when different possibilities, grid or not grid, spacing or not spacing
svn path=/trunk/KDE/kdebase/apps/; revision=687849
Diffstat (limited to 'src')
| -rw-r--r-- | src/kcategorizedview.cpp | 50 |
1 files changed, 38 insertions, 12 deletions
diff --git a/src/kcategorizedview.cpp b/src/kcategorizedview.cpp index cc83e2de9..97045f383 100644 --- a/src/kcategorizedview.cpp +++ b/src/kcategorizedview.cpp @@ -201,15 +201,32 @@ QRect KCategorizedView::Private::visualRectInViewport(const QModelIndex &index) if (rows - trunc(rows)) rowsInt++; - retRect.setTop(retRect.top() + - (rowsInt * listView->spacing()) + - (rowsInt * itemHeight) + - itemCategorizer->categoryHeight(listView->viewOptions()) + - listView->spacing() * 2); + if (listView->gridSize().isEmpty()) + { + retRect.setTop(retRect.top() + + (rowsInt * listView->spacing()) + + (rowsInt * itemHeight) + + itemCategorizer->categoryHeight(listView->viewOptions()) + + listView->spacing() * 2); + } + else + { + retRect.setTop(retRect.top() + + (rowsInt * itemHeight) + + itemCategorizer->categoryHeight(listView->viewOptions())); + } } - retRect.setTop(retRect.top() + row * listView->spacing() + - row * itemHeight); + + if (listView->gridSize().isEmpty()) + { + retRect.setTop(retRect.top() + row * listView->spacing() + + (row * itemHeight)); + } + else + { + retRect.setTop(retRect.top() + (row * itemHeight)); + } retRect.setWidth(itemWidth); @@ -272,11 +289,20 @@ QRect KCategorizedView::Private::visualCategoryRectInViewport(const QString &cat if (rows - trunc(rows)) rowsInt++; - retRect.setTop(retRect.top() + - (rowsInt * listView->spacing()) + - (rowsInt * itemHeight) + - itemCategorizer->categoryHeight(listView->viewOptions()) + - listView->spacing() * 2); + if (listView->gridSize().isEmpty()) + { + retRect.setTop(retRect.top() + + (rowsInt * listView->spacing()) + + (rowsInt * itemHeight) + + itemCategorizer->categoryHeight(listView->viewOptions()) + + listView->spacing() * 2); + } + else + { + retRect.setTop(retRect.top() + + (rowsInt * itemHeight) + + itemCategorizer->categoryHeight(listView->viewOptions())); + } } retRect.setHeight(itemCategorizer->categoryHeight(listView->viewOptions())); |
