mirror of
https://github.com/ankitects/anki.git
synced 2025-09-20 06:52:21 -04:00
Merge pull request #133 from hssm/browser-recenter
Fix automatic horizontal scrolling in browser
This commit is contained in:
commit
d824f178cc
1 changed files with 4 additions and 0 deletions
|
@ -189,7 +189,11 @@ class DataModel(QAbstractTableModel):
|
||||||
tv = self.browser.form.tableView
|
tv = self.browser.form.tableView
|
||||||
if idx:
|
if idx:
|
||||||
tv.selectRow(idx.row())
|
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.scrollTo(idx, tv.PositionAtCenter)
|
||||||
|
tv.horizontalScrollBar().setValue(h)
|
||||||
if count < 500:
|
if count < 500:
|
||||||
# discard large selections; they're too slow
|
# discard large selections; they're too slow
|
||||||
sm.select(items, QItemSelectionModel.SelectCurrent |
|
sm.select(items, QItemSelectionModel.SelectCurrent |
|
||||||
|
|
Loading…
Reference in a new issue