diff options
| author | Rafael Fernández López <[email protected]> | 2007-07-01 17:09:47 +0000 |
|---|---|---|
| committer | Rafael Fernández López <[email protected]> | 2007-07-01 17:09:47 +0000 |
| commit | 94cfa325caef933e833bf8a14ac323cec0f2d499 (patch) | |
| tree | 39d93984a03a4dd60790a4e2e7a85b2694b51599 /src/klistview.cpp | |
| parent | 2578bea1d8f58a2eaeac56e4782f4bfc816728af (diff) | |
Improve speed when we have lots of selections that are partially outside the viewport.
svn path=/trunk/KDE/kdebase/apps/; revision=682114
Diffstat (limited to 'src/klistview.cpp')
| -rw-r--r-- | src/klistview.cpp | 16 |
1 files changed, 10 insertions, 6 deletions
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); |
