From a59d9f85fa770a00d10e66025e102c736e18fa70 Mon Sep 17 00:00:00 2001 From: Amol Godbole Date: Fri, 13 Oct 2023 21:08:35 -0500 Subject: KItemListView: add view position in scrollToItem() An item, on being scrolled to, is always located at the nearest edge of the view. This is not always convenient. Allow specifying where the item should be positioned with respect to the view in scrollToItem(). BUG: 423884 --- src/kitemviews/kitemlistcontroller.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/kitemviews/kitemlistcontroller.cpp') diff --git a/src/kitemviews/kitemlistcontroller.cpp b/src/kitemviews/kitemlistcontroller.cpp index be7a63e09..0016bb22a 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); } } -- cgit v1.3 From 5c7887a763ea1a58ebcf93c047ab39b00eb6a8eb Mon Sep 17 00:00:00 2001 From: Felix Ernst Date: Mon, 23 Oct 2023 14:26:52 +0000 Subject: Fix rubberband selection on icon in icon view mode As an unintended side-effect of d9a18b04ea0b1b4e427f45083fdc0cdec87cbbfd items would no longer be selected in icon view mode when the selection rectangle intersected with the item's icon. This commit fixes this. --- src/kitemviews/kitemlistcontroller.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/kitemviews/kitemlistcontroller.cpp') diff --git a/src/kitemviews/kitemlistcontroller.cpp b/src/kitemviews/kitemlistcontroller.cpp index 0016bb22a..5abf1830b 100644 --- a/src/kitemviews/kitemlistcontroller.cpp +++ b/src/kitemviews/kitemlistcontroller.cpp @@ -1299,7 +1299,8 @@ void KItemListController::slotRubberBandChanged() if (widgetRect.intersects(rubberBandRect)) { // Select the full row intersecting with the rubberband rectangle const QRectF selectionRect = widget->selectionRect().translated(widgetRect.topLeft()); - if (selectionRect.intersects(rubberBandRect)) { + const QRectF iconRect = widget->iconRect().translated(widgetRect.topLeft()); + if (selectionRect.intersects(rubberBandRect) || iconRect.intersects(rubberBandRect)) { selectedItems.insert(index); } } -- cgit v1.3