Improve speed when we have lots of selections that are partially outside the viewport.

svn path=/trunk/KDE/kdebase/apps/; revision=682114
This commit is contained in:
Rafael Fernández López 2007-07-01 17:09:47 +00:00
parent 2578bea1d8
commit 94cfa325ca

View file

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