Partially revert "don't select contiguously with shift+click"

I thought this could work, but users (including myself!) are used to
being able to shift+click to select a region, and this behaviour is
surprising. We're also doing potentially expensive searches for each
extra selected item. I think we may need to switch this behaviour to
the right mouse button instead.

This partially reverts commit c91d21e18e.
This commit is contained in:
Damien Elmes 2021-02-09 10:02:24 +10:00
parent 2a0bc15a0b
commit 09dfbfe2b9

View File

@ -396,18 +396,6 @@ class SidebarTreeView(QTreeView):
else:
super().keyPressEvent(event)
# don't extend selection when shift+clicking with mouse (conflicts
# with OR-ing). User can still shift+up/down to select contiguously.
def selectionCommand(
self, index: QModelIndex, event: QEvent = None
) -> QItemSelectionModel.SelectionFlags:
flags = super().selectionCommand(index, event)
mods = self.mw.app.keyboardModifiers()
if isinstance(event, QMouseEvent) and mods & Qt.ShiftModifier:
# pylint: disable=no-member
flags &= ~QItemSelectionModel.SelectionFlag.Current # type: ignore
return flags
###########
def handle_drag_drop(self, sources: List[SidebarItem], target: SidebarItem) -> bool: