avoid adjusting position if selected row is visible
https://anki.tenderapp.com/discussions/beta-testing/1868-anki-2124-beta#comment_48227037
This commit is contained in:
parent
2f1523f82a
commit
0c5f22f4ae
@ -255,9 +255,14 @@ class DataModel(QAbstractTableModel):
|
||||
idx = focusedIdx or firstIdx
|
||||
tv = self.browser.form.tableView
|
||||
if idx:
|
||||
tv.selectRow(idx.row())
|
||||
row = idx.row()
|
||||
pos = tv.rowViewportPosition(row)
|
||||
visible = pos >= 0 and pos < tv.viewport().height()
|
||||
tv.selectRow(row)
|
||||
|
||||
# we save and then restore the horizontal scroll position because
|
||||
# scrollTo() also scrolls horizontally which is confusing
|
||||
if not visible:
|
||||
h = tv.horizontalScrollBar().value()
|
||||
tv.scrollTo(idx, tv.PositionAtCenter)
|
||||
tv.horizontalScrollBar().setValue(h)
|
||||
|
Loading…
Reference in New Issue
Block a user