diff --git a/dolphin/src/klistview.cpp b/dolphin/src/klistview.cpp index 403e984a29..526fb8dfcd 100644 --- a/dolphin/src/klistview.cpp +++ b/dolphin/src/klistview.cpp @@ -637,19 +637,6 @@ void KListView::paintEvent(QPaintEvent *event) itemDelegate(index)->paint(&painter, option, index); } - // Redraw categories - QStyleOptionViewItem otherOption; - foreach (const QString &category, d->categories) - { - otherOption = option; - otherOption.rect = d->categoryVisualRect(category); - - if (otherOption.rect.intersects(area)) - { - d->drawNewCategory(category, otherOption, &painter); - } - } - if (d->mouseButtonPressed && !d->isDragging) { QPoint start, end, initialPressPosition; @@ -681,6 +668,19 @@ void KListView::paintEvent(QPaintEvent *event) painter.restore(); } + // Redraw categories + QStyleOptionViewItem otherOption; + foreach (const QString &category, d->categories) + { + otherOption = option; + otherOption.rect = d->categoryVisualRect(category); + + if (otherOption.rect.intersects(area)) + { + d->drawNewCategory(category, otherOption, &painter); + } + } + if (d->isDragging && !d->dragLeftViewport) { painter.setOpacity(0.5); @@ -801,6 +801,37 @@ void KListView::mouseMoveEvent(QMouseEvent *event) viewport()->update(d->categoryVisualRect(category)); } + + QRect rect; + if (d->mouseButtonPressed && !d->isDragging) + { + QPoint start, end, initialPressPosition; + + initialPressPosition = d->initialPressPosition; + + initialPressPosition.setY(initialPressPosition.y() - verticalOffset()); + initialPressPosition.setX(initialPressPosition.x() - horizontalOffset()); + + if (d->initialPressPosition.x() > d->mousePosition.x() || + d->initialPressPosition.y() > d->mousePosition.y()) + { + start = d->mousePosition; + end = initialPressPosition; + } + else + { + start = initialPressPosition; + end = d->mousePosition; + } + + viewport()->update(d->lastSelectionRect); + + rect = QRect(start, end).intersected(viewport()->rect().adjusted(-16, -16, 16, 16)); + + viewport()->update(rect); + + d->lastSelectionRect = rect; + } } void KListView::mousePressEvent(QMouseEvent *event) diff --git a/dolphin/src/klistview_p.h b/dolphin/src/klistview_p.h index 11c0c3a6e8..b590b23078 100644 --- a/dolphin/src/klistview_p.h +++ b/dolphin/src/klistview_p.h @@ -143,6 +143,7 @@ public: QStringList categories; QModelIndexList intersectedIndexes; QRect lastDraggedItemsRect; + QRect lastSelectionRect; // Attributes for speed reasons KSortFilterProxyModel *proxyModel;