]> cloud.milkyroute.net Git - dolphin.git/commitdiff
If we are out of the screen and we will be, why keep asking when we know that no...
authorRafael Fernández López <ereslibre@kde.org>
Sun, 14 Oct 2007 23:01:35 +0000 (23:01 +0000)
committerRafael Fernández López <ereslibre@kde.org>
Sun, 14 Oct 2007 23:01:35 +0000 (23:01 +0000)
svn path=/trunk/KDE/kdebase/apps/; revision=725213

src/kcategorizedview.cpp

index a3e60f1c478c39bf7a50f5521813a2bcaea7a279..24603b98bd6bd56d5368118b6b9205aff61ae6ef 100644 (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)