@@ -104,11 +104,10 @@ def deactivate(self):
104104
105105 def canvasMoveEvent (self , e : QEvent ) -> None :
106106 hovering = self .check_annotation_hover (e .pos ())
107- if hovering :
107+ if hovering and not QApplication . overrideCursor () == QtCore . Qt . CursorShape . OpenHandCursor :
108108 QApplication .setOverrideCursor (QtCore .Qt .CursorShape .OpenHandCursor )
109- else :
110- if not self .moving :
111- QApplication .restoreOverrideCursor ()
109+ elif not hovering and not self .moving :
110+ QApplication .restoreOverrideCursor ()
112111
113112 def check_annotation_hover (self , pos : QMouseEvent ) -> int :
114113 click = [pos .x (), pos .y ()]
@@ -128,6 +127,8 @@ def check_annotation_hover(self, pos: QMouseEvent) -> int:
128127 if dists and min (dists ) < self .click_dist :
129128 idx = dists [min (dists )]
130129 return idx
130+ else :
131+ return 0
131132
132133 def keyPressEvent (self , event : QEvent ) -> None :
133134 if event .key () == Qt .Key .Key_Escape :
@@ -151,6 +152,9 @@ def keyPressEvent(self, event: QEvent) -> None:
151152 self .dlg ._clear_listwidget ()
152153
153154 def canvasPressEvent (self , event : QEvent ) -> None :
155+ if event .button () == Qt .MouseButton .RightButton :
156+ return
157+
154158 hovering = self .check_annotation_hover (event .pos ())
155159 if hovering :
156160 QApplication .setOverrideCursor (QtCore .Qt .CursorShape .ClosedHandCursor )
@@ -164,6 +168,7 @@ def canvasPressEvent(self, event: QEvent) -> None:
164168
165169 def canvasReleaseEvent (self , event : QEvent ) -> None :
166170 if event .button () == Qt .MouseButton .RightButton :
171+ QApplication .restoreOverrideCursor ()
167172 self .dlg .show ()
168173 return
169174
0 commit comments