From 4b1a8fe6b42f743465efa9c0d32056a8ff8cee42 Mon Sep 17 00:00:00 2001 From: KIU Shueng Chuan Date: Sat, 16 Jan 2021 00:16:28 +0800 Subject: [PATCH] call GraphicsView.enterEvent() with QEnterEvent Qt5 prototype is QWidget::enterEvent(QEvent*) Qt6 prototype is QWidget::enterEvent(QEnterEvent*) where QEnterEvent inherits from QEvent RemoteGraphicsView.enterEvent() is actually already called with a QEnterEvent instance, so all we need to do is to be able to reconstruct it in Renderer.enterEvent() --- pyqtgraph/widgets/RemoteGraphicsView.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/pyqtgraph/widgets/RemoteGraphicsView.py b/pyqtgraph/widgets/RemoteGraphicsView.py index bdf7400f..877425d1 100644 --- a/pyqtgraph/widgets/RemoteGraphicsView.py +++ b/pyqtgraph/widgets/RemoteGraphicsView.py @@ -187,7 +187,8 @@ class RemoteGraphicsView(QtGui.QWidget): return QtGui.QWidget.keyEvent(self, ev) def enterEvent(self, ev): - self._view.enterEvent(int(ev.type()), _callSync='off') + lws = ev.localPos(), ev.windowPos(), ev.screenPos() + self._view.enterEvent(lws, _callSync='off') return QtGui.QWidget.enterEvent(self, ev) def leaveEvent(self, ev): @@ -325,8 +326,8 @@ class Renderer(GraphicsView): GraphicsView.keyEvent(self, QtGui.QKeyEvent(typ, mods, text, autorep, count)) return ev.accepted() - def enterEvent(self, typ): - ev = QtCore.QEvent(QtCore.QEvent.Type(typ)) + def enterEvent(self, lws): + ev = QtGui.QEnterEvent(*lws) return GraphicsView.enterEvent(self, ev) def leaveEvent(self, typ):