From 7a604822690b005e2058da923ad5373c4b789a0c Mon Sep 17 00:00:00 2001 From: Houssam Salem Date: Tue, 7 Jun 2016 16:32:19 +1000 Subject: [PATCH] Fix automatic horizontal scrolling in browser --- aqt/browser.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/aqt/browser.py b/aqt/browser.py index 11c26db69..f4ffea87a 100644 --- a/aqt/browser.py +++ b/aqt/browser.py @@ -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 |