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)
This commit is contained in:
Richard Romero Jr 2024-06-01 03:54:44 -04:00 committed by GitHub
parent 4ab0db3127
commit 81de39768c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 5 additions and 1 deletions

View File

@ -173,6 +173,7 @@ jthulhu <https://github.com/jthulhu>
Escape0707 <tothesong@gmail.com>
Loudwig <https://github.com/Loudwig>
Wu Yi-Wei <https://github.com/Ianwu0812>
RRomeroJr <117.rromero@gmail.com>
********************

View File

@ -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