From 9a844591feffbd103281209b851b01b4d1cc4fbc Mon Sep 17 00:00:00 2001 From: RumovZ Date: Tue, 9 Mar 2021 20:36:15 +0100 Subject: [PATCH] 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. --- qt/aqt/sidebar.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/qt/aqt/sidebar.py b/qt/aqt/sidebar.py index 624b8e3d4..729b815e7 100644 --- a/qt/aqt/sidebar.py +++ b/qt/aqt/sidebar.py @@ -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()