Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

MNT: be more careful in Qt backend that there is actually a Figure #27245

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 1, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 14 additions & 6 deletions 20 lib/matplotlib/backends/backend_qt.py
Original file line number Diff line number Diff line change
Expand Up @@ -261,43 +261,49 @@ def enterEvent(self, event):
# Force querying of the modifiers, as the cached modifier state can
# have been invalidated while the window was out of focus.
mods = QtWidgets.QApplication.instance().queryKeyboardModifiers()
if self.figure is None:
return
LocationEvent("figure_enter_event", self,
*self.mouseEventCoords(event),
modifiers=self._mpl_modifiers(mods),
guiEvent=event)._process()

def leaveEvent(self, event):
QtWidgets.QApplication.restoreOverrideCursor()
if self.figure is None:
return
LocationEvent("figure_leave_event", self,
*self.mouseEventCoords(),
modifiers=self._mpl_modifiers(),
guiEvent=event)._process()

def mousePressEvent(self, event):
button = self.buttond.get(event.button())
if button is not None:
if button is not None and self.figure is not None:
MouseEvent("button_press_event", self,
*self.mouseEventCoords(event), button,
modifiers=self._mpl_modifiers(),
guiEvent=event)._process()

def mouseDoubleClickEvent(self, event):
button = self.buttond.get(event.button())
if button is not None:
if button is not None and self.figure is not None:
MouseEvent("button_press_event", self,
*self.mouseEventCoords(event), button, dblclick=True,
modifiers=self._mpl_modifiers(),
guiEvent=event)._process()

def mouseMoveEvent(self, event):
if self.figure is None:
return
MouseEvent("motion_notify_event", self,
*self.mouseEventCoords(event),
modifiers=self._mpl_modifiers(),
guiEvent=event)._process()

def mouseReleaseEvent(self, event):
button = self.buttond.get(event.button())
if button is not None:
if button is not None and self.figure is not None:
MouseEvent("button_release_event", self,
*self.mouseEventCoords(event), button,
modifiers=self._mpl_modifiers(),
Expand All @@ -311,29 +317,31 @@ def wheelEvent(self, event):
steps = event.angleDelta().y() / 120
else:
steps = event.pixelDelta().y()
if steps:
if steps and self.figure is not None:
MouseEvent("scroll_event", self,
*self.mouseEventCoords(event), step=steps,
modifiers=self._mpl_modifiers(),
guiEvent=event)._process()

def keyPressEvent(self, event):
key = self._get_key(event)
if key is not None:
if key is not None and self.figure is not None:
KeyEvent("key_press_event", self,
key, *self.mouseEventCoords(),
guiEvent=event)._process()

def keyReleaseEvent(self, event):
key = self._get_key(event)
if key is not None:
if key is not None and self.figure is not None:
KeyEvent("key_release_event", self,
key, *self.mouseEventCoords(),
guiEvent=event)._process()

def resizeEvent(self, event):
if self._in_resize_event: # Prevent PyQt6 recursion
return
if self.figure is None:
return
self._in_resize_event = True
try:
w = event.size().width() * self.device_pixel_ratio
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.