From: Rafael Fernández López Date: Sun, 1 Jul 2007 17:09:47 +0000 (+0000) Subject: Improve speed when we have lots of selections that are partially outside the viewport. X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/commitdiff_plain/94cfa325caef933e833bf8a14ac323cec0f2d499?ds=inline Improve speed when we have lots of selections that are partially outside the viewport. svn path=/trunk/KDE/kdebase/apps/; revision=682114 --- diff --git a/src/klistview.cpp b/src/klistview.cpp index 1e9e1b013..e3ea89e41 100644 --- a/src/klistview.cpp +++ b/src/klistview.cpp @@ -399,25 +399,29 @@ void KListView::Private::drawDraggedItems(QPainter *painter) option.rect = visualRect(index); option.rect.adjust(dx, dy, dx, dy); - listView->itemDelegate(index)->paint(painter, option, index); + if (option.rect.intersects(listView->viewport()->rect())) + { + listView->itemDelegate(index)->paint(painter, option, index); + } } } void KListView::Private::drawDraggedItems() { - int dx; - int dy; QRect rectToUpdate; QRect currentRect; foreach (const QModelIndex &index, listView->selectionModel()->selectedIndexes()) { - dx = mousePosition.x() - initialPressPosition.x() + listView->horizontalOffset(); - dy = mousePosition.y() - initialPressPosition.y() + listView->verticalOffset(); + int dx = mousePosition.x() - initialPressPosition.x() + listView->horizontalOffset(); + int dy = mousePosition.y() - initialPressPosition.y() + listView->verticalOffset(); currentRect = visualRect(index); currentRect.adjust(dx, dy, dx, dy); - rectToUpdate = rectToUpdate.united(currentRect); + if (currentRect.intersects(listView->viewport()->rect())) + { + rectToUpdate = rectToUpdate.united(currentRect); + } } listView->viewport()->update(lastDraggedItemsRect);