From d6eac551b17b3679d860006700a6ea8933a22a37 Mon Sep 17 00:00:00 2001 From: bluegreenmagick Date: Sat, 20 Feb 2021 22:58:02 +0900 Subject: [PATCH 1/2] change _on_click_current to _on_click_index fix bug where clicking on a blank space below sidebar item would still trigger currentIndex item's click event --- qt/aqt/sidebar.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/qt/aqt/sidebar.py b/qt/aqt/sidebar.py index 60a0ebc69..41856e3c7 100644 --- a/qt/aqt/sidebar.py +++ b/qt/aqt/sidebar.py @@ -442,11 +442,13 @@ class SidebarTreeView(QTreeView): def mouseReleaseEvent(self, event: QMouseEvent) -> None: super().mouseReleaseEvent(event) if event.button() == Qt.LeftButton: - self._on_click_current() + idx = self.indexAt(event.pos()) + self._on_click_index(idx) def keyPressEvent(self, event: QKeyEvent) -> None: if event.key() in (Qt.Key_Return, Qt.Key_Enter): - self._on_click_current() + idx = self.currentIndex() + self._on_click_index(idx) else: super().keyPressEvent(event) @@ -516,8 +518,7 @@ class SidebarTreeView(QTreeView): self.browser.editor.saveNow(on_save) return True - def _on_click_current(self) -> None: - idx = self.currentIndex() + def _on_click_index(self, idx: QModelIndex) -> None: if item := self.model().item_for_index(idx): if item.on_click: item.on_click() From 86cf6526096ae48be0b57330ae7a0cb4dde517b8 Mon Sep 17 00:00:00 2001 From: BlueGreenMagick Date: Sat, 20 Feb 2021 23:11:46 +0900 Subject: [PATCH 2/2] Update CONTRIBUTORS Add email so it recognizes the change of email --- CONTRIBUTORS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTORS b/CONTRIBUTORS index 9649c2e9d..083e82d3e 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -35,7 +35,7 @@ zjosua Arthur Milchior Yngve Hoiseth Ijgnd -Yoonchae Lee +Yoonchae Lee Evandro Coan Alan Du Yuchen Lei