diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/kcategorizedview.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/kcategorizedview.cpp b/src/kcategorizedview.cpp index a3e60f1c4..24603b98b 100644 --- a/src/kcategorizedview.cpp +++ b/src/kcategorizedview.cpp @@ -743,6 +743,7 @@ void KCategorizedView::paintEvent(QPaintEvent *event) // Redraw categories QStyleOptionViewItem otherOption; + bool intersectedInThePast = false; foreach (const QString &category, d->categories) { otherOption = option; @@ -751,11 +752,18 @@ void KCategorizedView::paintEvent(QPaintEvent *event) if (otherOption.rect.intersects(area)) { + intersectedInThePast = true; + QModelIndex indexToDraw = d->proxyModel->index(d->categoriesIndexes[category][0].row(), d->proxyModel->sortColumn()); d->drawNewCategory(indexToDraw, d->proxyModel->sortRole(), otherOption, &painter); } + else if (intersectedInThePast) + { + break; // the visible area has been finished, we don't need to keep asking, the rest won't intersect + // this is doable because we know that categories are correctly ordered on the list + } } if (d->mouseButtonPressed && !d->isDragging) |
