mirror of
https://github.com/ankitects/anki.git
synced 2025-09-24 16:56:36 -04:00
skip scroll if the number of cards has not changed
The scrolling behaviour is useful when cards are deleted, but annoying in other cases such as when changing flags.
This commit is contained in:
parent
6609dfda7b
commit
fea23177e8
1 changed files with 7 additions and 5 deletions
|
@ -207,11 +207,13 @@ class DataModel(QAbstractTableModel):
|
|||
tv = self.browser.form.tableView
|
||||
if idx:
|
||||
tv.selectRow(idx.row())
|
||||
# we save and then restore the horizontal scroll position because
|
||||
# scrollTo() also scrolls horizontally which is confusing
|
||||
h = tv.horizontalScrollBar().value()
|
||||
tv.scrollTo(idx, tv.PositionAtCenter)
|
||||
tv.horizontalScrollBar().setValue(h)
|
||||
# scroll if the selection count has changed
|
||||
if count != len(self.selectedCards):
|
||||
# we save and then restore the horizontal scroll position because
|
||||
# scrollTo() also scrolls horizontally which is confusing
|
||||
h = tv.horizontalScrollBar().value()
|
||||
tv.scrollTo(idx, tv.PositionAtCenter)
|
||||
tv.horizontalScrollBar().setValue(h)
|
||||
if count < 500:
|
||||
# discard large selections; they're too slow
|
||||
sm.select(items, QItemSelectionModel.SelectCurrent |
|
||||
|
|
Loading…
Reference in a new issue