mirror of
https://github.com/ankitects/anki.git
synced 2026-01-14 14:29:10 -05: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
984de2e57e
commit
555e94f558
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