From 3b32e27083b14fcd434d08e87f3a1ba3c60f984b Mon Sep 17 00:00:00 2001 From: KIU Shueng Chuan Date: Thu, 13 May 2021 08:57:15 +0800 Subject: [PATCH] RemoteGraphicsView.py : fix deprecated mouse positions --- pyqtgraph/widgets/RemoteGraphicsView.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/pyqtgraph/widgets/RemoteGraphicsView.py b/pyqtgraph/widgets/RemoteGraphicsView.py index 2989f184..39570475 100644 --- a/pyqtgraph/widgets/RemoteGraphicsView.py +++ b/pyqtgraph/widgets/RemoteGraphicsView.py @@ -100,7 +100,8 @@ class RemoteGraphicsView(QtGui.QWidget): return args def serialize_mouse_event(self, ev): - lpos, gpos = ev.localPos(), ev.screenPos() + lpos = ev.position() if hasattr(ev, 'position') else ev.localPos() + gpos = ev.globalPosition() if hasattr(ev, 'globalPosition') else ev.screenPos() typ, btn, btns, mods = self.serialize_mouse_enum( ev.type(), ev.button(), ev.buttons(), ev.modifiers()) return (typ, lpos, gpos, btn, btns, mods) @@ -137,7 +138,11 @@ class RemoteGraphicsView(QtGui.QWidget): return super().wheelEvent(ev) def enterEvent(self, ev): - lws = ev.localPos(), ev.windowPos(), ev.screenPos() + lpos = ev.position() if hasattr(ev, 'position') else ev.localPos() + wpos = ev.scenePosition() if hasattr(ev, 'scenePosition') else ev.windowPos() + gpos = ev.globalPosition() if hasattr(ev, 'globalPosition') else ev.screenPos() + + lws = lpos, wpos, gpos self._view.enterEvent(lws, _callSync='off') return super().enterEvent(ev)