Details
-
Bug
-
Resolution: Unresolved
-
P2: Important
-
None
-
6.2.4, 6.3, 6.4, 6.5, 6.6
-
None
Description
Selecting items using Shift key is very hard. The selection is lost after clicking the last item while pressing shift key. It's very annoying. It looks like it's a regression from previous versions. It was supposed to be fixed. See this bug : https://bugreports.qt.io/browse/QTBUG-81542
The issue appeared in Qt 6.2.4 and is still present in Qt 6.6. It worked well in Qt 6.2.3.
I attached a video showing the issue in Qt 6.2.3, 6.2.4 and Qt 6.6.0. I'm holding shift key to select multiple items.
I also attached the sample project based on relationaltablemodel sample.
I've just added these lines in relationaltablemodel sample :
// Code added to reproduce the bug view->setSelectionMode(QAbstractItemView::ExtendedSelection); view->setDragEnabled(true); // end of added code
For those having trouble with this bug, I've found this workaround that seems to work well:
void InheritedTableView::mousePressEvent(QMouseEvent *event) { #if (QT_VERSION >= QT_VERSION_CHECK(6, 2, 4)) // workaround for selection bug using shift key in Qt 6.2.4 and above (no bug in Qt 6.2.3): // when the mouse moves 1 pixel when making a range selection (shift + left-mouse-button), the selection resets to just the last item clicked. // see https://bugreports.qt.io/browse/QTBUG-120272 if (event->modifiers() & Qt::ShiftModifier) { bool isDragEnabled = dragEnabled(); setDragEnabled(false); QTableView::mousePressEvent(event); setDragEnabled(isDragEnabled); return; } #endif QTableView::mousePressEvent(event); }
Attachments
Issue Links
- relates to
-
QTBUG-98961 abstractitemview drag item can not autoscroll
- Closed
-
QTBUG-96124 QListview automatic scrolling should consider when the item is not selected
- Closed
- replaces
-
QTBUG-81542 QListView range selection changes after 1 pixel move
- Closed