Merge pull request #133 from hssm/browser-recenter

Fix automatic horizontal scrolling in browser
This commit is contained in:
Damien Elmes 2016-07-04 16:29:45 +10:00 committed by GitHub
commit d824f178cc

View File

@ -189,7 +189,11 @@ 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)
if count < 500:
# discard large selections; they're too slow
sm.select(items, QItemSelectionModel.SelectCurrent |