Ensure mouse is at current index before searching

Thus, no search will be triggered when clicking an expansion indicator
as this doesn't update the current element. However, if the indicator
belongs to the current item, a search will be triggered anyway.
This commit is contained in:
RumovZ 2021-03-09 20:36:15 +01:00
parent a9ea7e39ae
commit 9a844591fe

View File

@ -545,8 +545,8 @@ class SidebarTreeView(QTreeView):
def mouseReleaseEvent(self, event: QMouseEvent) -> None:
super().mouseReleaseEvent(event)
if self.tool == SidebarTool.SEARCH and event.button() == Qt.LeftButton:
idx = self.indexAt(event.pos())
self._on_search(idx)
if (index := self.currentIndex()) == self.indexAt(event.pos()):
self._on_search(index)
def keyPressEvent(self, event: QKeyEvent) -> None:
index = self.currentIndex()