X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/blobdiff_plain/6c64d1ca6b37c24b8e6f79f02923aeca9de2616d..d511752c9de4d9adc30a15ddf9bf89efc1924a7b:/src/kcategorizedview.cpp diff --git a/src/kcategorizedview.cpp b/src/kcategorizedview.cpp index 3255de9a4..214fa39d2 100644 --- a/src/kcategorizedview.cpp +++ b/src/kcategorizedview.cpp @@ -98,6 +98,17 @@ const QModelIndexList &KCategorizedView::Private::intersectionSet(const QRect &r intersectedIndexes.clear(); + int itemHeight; + + if (listView->gridSize().isEmpty()) + { + itemHeight = biggestItemSize.height(); + } + else + { + itemHeight = listView->gridSize().height(); + } + // Lets find out where we should start int top = proxyModel->rowCount() - 1; int bottom = 0; @@ -108,10 +119,13 @@ const QModelIndexList &KCategorizedView::Private::intersectionSet(const QRect &r index = elementDictionary[proxyModel->index(middle, 0)]; indexVisualRect = visualRect(index); + // We need the whole height (not only the visualRect). This will help us to update + // all needed indexes correctly (ereslibre) + indexVisualRect.setHeight(indexVisualRect.height() + (itemHeight - indexVisualRect.height())); if (qMax(indexVisualRect.topLeft().y(), indexVisualRect.bottomRight().y()) < qMin(rect.topLeft().y(), - rect.bottomRight().y())) + rect.bottomRight().y())) { bottom = middle + 1; } @@ -188,14 +202,27 @@ 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())); + } } - 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); @@ -259,10 +286,15 @@ 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())); + } } retRect.setHeight(itemCategorizer->categoryHeight(listView->viewOptions()));