┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRafael Fernández López <[email protected]>2007-10-14 23:01:35 +0000
committerRafael Fernández López <[email protected]>2007-10-14 23:01:35 +0000
commit6d10e57f88d9215e7d0bd810fef6c302b73e08ec (patch)
treeec3ec2f25fcbf0f1c867efaea0b2275e8f479fb3
parent417a1f6256c704a51e4883adad4608c78c0cdc3c (diff)
If we are out of the screen and we will be, why keep asking when we know that no category will intersect from now with the viewport
svn path=/trunk/KDE/kdebase/apps/; revision=725213
-rw-r--r--src/kcategorizedview.cpp8
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)