Details
-
Bug
-
Resolution: Unresolved
-
P3: Somewhat important
-
None
-
5.12.7, 5.15.0, 6.1.0
-
None
Description
Selecting Items while holding SHIFT may cause other unrelated items to be selected as well. This can be observed when QListView is operating in IconMode and icons of different sizes are shown (i.e. uniformItemSizes() == false).
Steps to reproduce:
- Compile the attached code (which is based on the official FetchMore example)
- Navigate to a directory that contains a couple of files
- You will notice that every tenth icon is bigger than the other ones (just for easier reproducibility)
- As shown in problem01.png, mouse-click-select an item after one of those bigger items
- Press and hold SHIFT
- As shown in problem02.png, mouse-click-select an item in the next row (marked with 2.)
- You will notice, that an unrelated bigger item (3.) has been selected as well.
The documentation of QAbstractItemView::ExtendedSelection says:
"If the user presses the Shift key while clicking on an item, all items between the current item and the clicked item are selected or unselected [...]."
Thus, the unrelated item at (3.) should not have been selected.
This becomes a serious problem when you want to implement an image viewer that supports deleting files: Selecting contiguous files and deleting them will cause other unrelated files to be selected and deleted as well without notice by the user.
Since the related bug QTBUG-4331 was simply closed I'm pretty sure this problem exists in all qt6 and qt5 versions. Particularly, I was able to reproduce it in 6.1.0, 5.12.7 and 5.15.0.