Use PositionAtCenter for sidebar scrolling

This commit is contained in:
abdo 2021-08-02 10:57:00 +03:00
parent 141a96e221
commit ad6f5c7404

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())