always position selection in center after search
https://anki.tenderapp.com/discussions/beta-testing/1888-retaining-position-when-searching
This commit is contained in:
parent
6495240914
commit
c050833aba
@ -261,13 +261,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())
|
||||||
# scroll if the selection count has changed
|
# we save and then restore the horizontal scroll position because
|
||||||
if count != len(self.selectedCards):
|
# scrollTo() also scrolls horizontally which is confusing
|
||||||
# we save and then restore the horizontal scroll position because
|
h = tv.horizontalScrollBar().value()
|
||||||
# scrollTo() also scrolls horizontally which is confusing
|
tv.scrollTo(idx, tv.PositionAtCenter)
|
||||||
h = tv.horizontalScrollBar().value()
|
tv.horizontalScrollBar().setValue(h)
|
||||||
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(
|
sm.select(
|
||||||
|
Loading…
Reference in New Issue
Block a user