minor follow-up to #1257
No need for a separate argument, as we only want to scroll when searching.
This commit is contained in:
parent
f8f6b828aa
commit
45b790ec3c
@ -215,17 +215,16 @@ class SidebarTreeView(QTreeView):
|
|||||||
# start from a collapsed state, as it's faster
|
# start from a collapsed state, as it's faster
|
||||||
self.collapseAll()
|
self.collapseAll()
|
||||||
self.setColumnHidden(0, not self.model().search(text))
|
self.setColumnHidden(0, not self.model().search(text))
|
||||||
self._expand_where_necessary(
|
self._expand_where_necessary(self.model(), searching=True)
|
||||||
self.model(), searching=True, scroll_to_first_match=True
|
|
||||||
)
|
|
||||||
|
|
||||||
def _expand_where_necessary(
|
def _expand_where_necessary(
|
||||||
self,
|
self,
|
||||||
model: SidebarModel,
|
model: SidebarModel,
|
||||||
parent: Optional[QModelIndex] = None,
|
parent: Optional[QModelIndex] = None,
|
||||||
searching: bool = False,
|
searching: bool = False,
|
||||||
scroll_to_first_match: bool = False,
|
|
||||||
) -> None:
|
) -> None:
|
||||||
|
scroll_to_first_match = searching
|
||||||
|
|
||||||
def expand_node(parent: QModelIndex) -> None:
|
def expand_node(parent: QModelIndex) -> None:
|
||||||
nonlocal scroll_to_first_match
|
nonlocal scroll_to_first_match
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user