From 2aed5c36d5b2c0dd170625ba20760c9a4687a5c7 Mon Sep 17 00:00:00 2001 From: KIU Shueng Chuan Date: Sun, 11 Apr 2021 09:47:51 +0800 Subject: [PATCH] no need to reconstruct PyQt6 enums PyQt6 can serialize / deserialize enums and flags w/o us manually casting them to int. In PyQt6 6.0, it was okay to pass the already deserialized flag back to the class constructor. In PyQt6 6.1, the flags MouseButtons and KeyboardModifiers have been renamed to MouseButton and KeyboardModifier respectively. skipping the reconstruction allows it to work on both PyQt6 6.0 and 6.1. note that this was already done in deserialize_mouse_event() --- 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 c9549c8a..f486b2f9 100644 --- a/pyqtgraph/widgets/RemoteGraphicsView.py +++ b/pyqtgraph/widgets/RemoteGraphicsView.py @@ -259,9 +259,10 @@ class Renderer(GraphicsView): def deserialize_wheel_event(self, wheel_event): pos, gpos, pixelDelta, angleDelta, btns, mods, phase, inverted = wheel_event - btns = QtCore.Qt.MouseButtons(btns) - mods = QtCore.Qt.KeyboardModifiers(mods) - phase = QtCore.Qt.ScrollPhase(phase) + if QT_LIB != 'PyQt6': + btns = QtCore.Qt.MouseButtons(btns) + mods = QtCore.Qt.KeyboardModifiers(mods) + phase = QtCore.Qt.ScrollPhase(phase) return QtGui.QWheelEvent(pos, gpos, pixelDelta, angleDelta, btns, mods, phase, inverted) def mousePressEvent(self, mouse_event):