X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/blobdiff_plain/89dcef3af497fb43ce612df45b1aa968a6a2ccb0..1826f905d706925456763394de17294bcb6d1c35:/src/kitemviews/kitemlistcontroller.cpp diff --git a/src/kitemviews/kitemlistcontroller.cpp b/src/kitemviews/kitemlistcontroller.cpp index 0f3c5bc8c..5abf1830b 100644 --- a/src/kitemviews/kitemlistcontroller.cpp +++ b/src/kitemviews/kitemlistcontroller.cpp @@ -539,7 +539,7 @@ void KItemListController::slotChangeCurrentItem(const QString &text, bool search m_selectionManager->beginAnchoredSelection(index); } - m_view->scrollToItem(index); + m_view->scrollToItem(index, KItemListView::ViewItemPosition::Beginning); } } @@ -654,11 +654,6 @@ bool KItemListController::mouseMoveEvent(QGraphicsSceneMouseEvent *event, const if (m_view->scrollOrientation() == Qt::Vertical) { endPos.ry() += m_view->scrollOffset(); - if (m_view->itemSize().width() < 0) { - // Use a special rubberband for views that have only one column and - // expand the rubberband to use the whole width of the view. - endPos.setX(m_view->size().width()); - } } else { endPos.rx() += m_view->scrollOffset(); } @@ -1302,9 +1297,10 @@ void KItemListController::slotRubberBandChanged() const QRectF widgetRect = m_view->itemRect(index); if (widgetRect.intersects(rubberBandRect)) { + // Select the full row intersecting with the rubberband rectangle + const QRectF selectionRect = widget->selectionRect().translated(widgetRect.topLeft()); const QRectF iconRect = widget->iconRect().translated(widgetRect.topLeft()); - const QRectF textRect = widget->textRect().translated(widgetRect.topLeft()); - if (iconRect.intersects(rubberBandRect) || textRect.intersects(rubberBandRect)) { + if (selectionRect.intersects(rubberBandRect) || iconRect.intersects(rubberBandRect)) { selectedItems.insert(index); } } @@ -1809,11 +1805,6 @@ void KItemListController::startRubberBand() QPoint startPos = m_view->transform().map(m_view->scene()->views().first()->mapFromGlobal(m_pressedMouseGlobalPos.toPoint())); if (m_view->scrollOrientation() == Qt::Vertical) { startPos.ry() += m_view->scrollOffset(); - if (m_view->itemSize().width() < 0) { - // Use a special rubberband for views that have only one column and - // expand the rubberband to use the whole width of the view. - startPos.setX(0); - } } else { startPos.rx() += m_view->scrollOffset(); }