From 09dfbfe2b9a8feb6792daef7eac7a0d151dc89cf Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Tue, 9 Feb 2021 10:02:24 +1000 Subject: [PATCH] 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 c91d21e18e76c322b76424c9e2850a48467837da. --- qt/aqt/sidebar.py | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/qt/aqt/sidebar.py b/qt/aqt/sidebar.py index e0044ef6d..ee2a2a00e 100644 --- a/qt/aqt/sidebar.py +++ b/qt/aqt/sidebar.py @@ -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: