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
This commit is contained in:
Rafael Fernández López 2007-10-14 23:01:35 +00:00
parent 417a1f6256
commit 6d10e57f88

View file

@ -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)