Merge pull request #1319 from abdnh/sidebar-scroll-center

Use PositionAtCenter for sidebar scrolling
This commit is contained in:
Damien Elmes 2021-08-02 18:35:38 +10:00 committed by GitHub
commit 528343b417
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -193,7 +193,7 @@ class SidebarTreeView(QTreeView):
self.selectionModel().setCurrentIndex(
index, QItemSelectionModel.SelectCurrent
)
self.scrollTo(index)
self.scrollTo(index, QAbstractItemView.PositionAtCenter)
def find_item(
self,
@ -249,7 +249,7 @@ class SidebarTreeView(QTreeView):
self.selectionModel().setCurrentIndex(
idx, QItemSelectionModel.SelectCurrent
)
self.scrollTo(idx)
self.scrollTo(idx, QAbstractItemView.PositionAtCenter)
scroll_to_first_match = False
expand_node(parent or QModelIndex())