Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 068e770

Browse files
committed
Attempt to add event corresponding to hover
1 parent e2b2c0e commit 068e770

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

lib/matplotlib/backends/backend_qt.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
from matplotlib.backend_bases import (
1010
_Backend, FigureCanvasBase, FigureManagerBase, NavigationToolbar2,
1111
TimerBase, cursors, ToolContainerBase, MouseButton,
12-
CloseEvent, KeyEvent, LocationEvent, MouseEvent, ResizeEvent)
12+
CloseEvent, KeyEvent, LocationEvent, MouseEvent, ResizeEvent, HoverEvent)
1313
import matplotlib.backends.qt_editor.figureoptions as figureoptions
1414
from . import qt_compat
1515
from .qt_compat import (
@@ -305,6 +305,17 @@ def mouseReleaseEvent(self, event):
305305
modifiers=self._mpl_modifiers(),
306306
guiEvent=event)._process()
307307

308+
def mouseOverEvent(self, event):
309+
artist = event.artist
310+
if not artist.get_hover:
311+
thismouse = MouseEvent("motion_notify_event", self,
312+
*self.mouseEventCoords(event),
313+
modifiers=self._mpl_modifiers(),
314+
guiEvent=event)
315+
hovering = HoverEvent("motion_notify_event", self,
316+
thismouse, artist, None)
317+
hovering._process()
318+
308319
def wheelEvent(self, event):
309320
# from QWheelEvent::pixelDelta doc: pixelDelta is sometimes not
310321
# provided (`isNull()`) and is unreliable on X11 ("xcb").

0 commit comments

Comments
 (0)