diff options
author | Eirik Aavitsland <eirik.aavitsland@qt.io> | 2019-12-05 15:59:01 +0100 |
---|---|---|
committer | Eirik Aavitsland <eirik.aavitsland@qt.io> | 2019-12-06 08:25:17 +0100 |
commit | 20266820a31d5cd4afc808bc8b3e9eb6e0396358 (patch) | |
tree | 75c99d9da1f3a5635f27299099c3bdea84d80bfe /src/widgets | |
parent | 843be88e297965ac3adcbdd68042beeff9a9cd03 (diff) |
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 <sona.kurazyan@qt.io>
Fixes: QTBUG-77336
Change-Id: I2d29cb0ca69c1058635106aa0c67e9f7e140d1cd
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
Diffstat (limited to 'src/widgets')
-rw-r--r-- | src/widgets/itemviews/qabstractitemview.cpp | 4 | ||||
-rw-r--r-- | src/widgets/itemviews/qlistview.cpp | 4 |
2 files changed, 6 insertions, 2 deletions
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; } |