From 20266820a31d5cd4afc808bc8b3e9eb6e0396358 Mon Sep 17 00:00:00 2001 From: Eirik Aavitsland Date: Thu, 5 Dec 2019 15:59:01 +0100 Subject: Item views: do not clip items horizontally in dragging icon The dragging icon is created from the visible items in the selection. It would be clipped to the parts visible in the viewport. That meant that items on the edge could be rendered illegible, even though they were part of what was being dragged. Fix by dropping the horizontal clipping to the viewport. Items fully outside the viewport are already filtered away, so this should at most make a difference to the bottom and/or top items in the set. Keep the vertical clipping, since items may easily be very wide, so an unclipped icon would be unwieldy. Done-With: Sona Kurazyan Fixes: QTBUG-77336 Change-Id: I2d29cb0ca69c1058635106aa0c67e9f7e140d1cd Reviewed-by: Sona Kurazyan Reviewed-by: Christian Ehrlicher --- src/widgets/itemviews/qabstractitemview.cpp | 4 +++- src/widgets/itemviews/qlistview.cpp | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) (limited to 'src/widgets/itemviews') diff --git a/src/widgets/itemviews/qabstractitemview.cpp b/src/widgets/itemviews/qabstractitemview.cpp index b1557e9af4..7ede46dbec 100644 --- a/src/widgets/itemviews/qabstractitemview.cpp +++ b/src/widgets/itemviews/qabstractitemview.cpp @@ -4451,7 +4451,9 @@ QItemViewPaintPairs QAbstractItemViewPrivate::draggablePaintPairs(const QModelIn rect |= current; } } - rect &= viewportRect; + QRect clipped = rect & viewportRect; + rect.setLeft(clipped.left()); + rect.setRight(clipped.right()); return ret; } diff --git a/src/widgets/itemviews/qlistview.cpp b/src/widgets/itemviews/qlistview.cpp index 04cddf2926..62fffc17df 100644 --- a/src/widgets/itemviews/qlistview.cpp +++ b/src/widgets/itemviews/qlistview.cpp @@ -664,7 +664,9 @@ QItemViewPaintPairs QListViewPrivate::draggablePaintPairs(const QModelIndexList rect |= current; } } - rect &= viewportRect; + QRect clipped = rect & viewportRect; + rect.setLeft(clipped.left()); + rect.setRight(clipped.right()); return ret; } -- cgit v1.2.3