From 81de39768c265926c5f5ce0cdfdea74072d366d8 Mon Sep 17 00:00:00 2001 From: Richard Romero Jr <104702290+RRomeroJr@users.noreply.github.com> Date: Sat, 1 Jun 2024 03:54:44 -0400 Subject: [PATCH] Fixes shift click selection after programmatic selection in most cases, Issue #2469 (#3213) * Fixes shift click selection after programmatic selection in most cases * Attempting to resolve checks * Adding comment for _move_current setCurrentIndex * Update qt/aqt/browser/table/table.py (dae) --- CONTRIBUTORS | 1 + qt/aqt/browser/table/table.py | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CONTRIBUTORS b/CONTRIBUTORS index 6260013fc..42648af03 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -173,6 +173,7 @@ jthulhu Escape0707 Loudwig Wu Yi-Wei +RRomeroJr <117.rromero@gmail.com> ******************** diff --git a/qt/aqt/browser/table/table.py b/qt/aqt/browser/table/table.py index 532757d78..384a28e67 100644 --- a/qt/aqt/browser/table/table.py +++ b/qt/aqt/browser/table/table.py @@ -608,7 +608,10 @@ class Table: direction, self.browser.mw.app.keyboardModifiers(), ) - self._view.selectionModel().setCurrentIndex( + # Setting current like this avoids a bug with shift-click selection + # https://github.com/ankitects/anki/issues/2469 + self._view.setCurrentIndex(index) + self._view.selectionModel().select( index, QItemSelectionModel.SelectionFlag.Clear | QItemSelectionModel.SelectionFlag.Select