mirror of
https://invent.kde.org/system/dolphin
synced 2024-11-05 18:47:12 +00:00
++optimization
svn path=/trunk/KDE/kdebase/apps/; revision=681449
This commit is contained in:
parent
123e5008ae
commit
71680def7f
2 changed files with 35 additions and 2 deletions
|
@ -409,6 +409,30 @@ void KListView::Private::drawDraggedItems(QPainter *painter)
|
|||
}
|
||||
}
|
||||
|
||||
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();
|
||||
|
||||
currentRect = visualRect(index);
|
||||
currentRect.adjust(dx, dy, dx, dy);
|
||||
|
||||
rectToUpdate = rectToUpdate.united(currentRect);
|
||||
}
|
||||
|
||||
listView->viewport()->update(lastDraggedItemsRect);
|
||||
|
||||
lastDraggedItemsRect = rectToUpdate;
|
||||
|
||||
listView->viewport()->update(rectToUpdate);
|
||||
}
|
||||
|
||||
|
||||
//==============================================================================
|
||||
|
||||
|
@ -890,6 +914,8 @@ void KListView::dragMoveEvent(QDragMoveEvent *event)
|
|||
}
|
||||
|
||||
d->dragLeftViewport = false;
|
||||
|
||||
d->drawDraggedItems();
|
||||
}
|
||||
|
||||
void KListView::dragLeaveEvent(QDragLeaveEvent *event)
|
||||
|
|
|
@ -99,10 +99,16 @@ public:
|
|||
void updateScrollbars();
|
||||
|
||||
/**
|
||||
* This method will draw dragged items
|
||||
* This method will draw dragged items in the painting operation
|
||||
*/
|
||||
void drawDraggedItems(QPainter *painter);
|
||||
|
||||
/**
|
||||
* This method will determine which rect needs to be updated because of a
|
||||
* dragging operation
|
||||
*/
|
||||
void drawDraggedItems();
|
||||
|
||||
|
||||
// Attributes
|
||||
|
||||
|
@ -121,6 +127,7 @@ public:
|
|||
bool isDragging;
|
||||
bool dragLeftViewport;
|
||||
QModelIndex hovered;
|
||||
QString hoveredCategory;
|
||||
QPoint initialPressPosition;
|
||||
QPoint mousePosition;
|
||||
QItemSelection lastSelection;
|
||||
|
@ -135,7 +142,7 @@ public:
|
|||
QHash<QString, QRect> categoriesPosition;
|
||||
QStringList categories;
|
||||
QModelIndexList intersectedIndexes;
|
||||
QString hoveredCategory;
|
||||
QRect lastDraggedItemsRect;
|
||||
|
||||
// Attributes for speed reasons
|
||||
KSortFilterProxyModel *proxyModel;
|
||||
|
|
Loading…
Reference in a new issue