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()
This commit is contained in:
parent
64702981d4
commit
2aed5c36d5
@ -259,9 +259,10 @@ class Renderer(GraphicsView):
|
|||||||
|
|
||||||
def deserialize_wheel_event(self, wheel_event):
|
def deserialize_wheel_event(self, wheel_event):
|
||||||
pos, gpos, pixelDelta, angleDelta, btns, mods, phase, inverted = wheel_event
|
pos, gpos, pixelDelta, angleDelta, btns, mods, phase, inverted = wheel_event
|
||||||
btns = QtCore.Qt.MouseButtons(btns)
|
if QT_LIB != 'PyQt6':
|
||||||
mods = QtCore.Qt.KeyboardModifiers(mods)
|
btns = QtCore.Qt.MouseButtons(btns)
|
||||||
phase = QtCore.Qt.ScrollPhase(phase)
|
mods = QtCore.Qt.KeyboardModifiers(mods)
|
||||||
|
phase = QtCore.Qt.ScrollPhase(phase)
|
||||||
return QtGui.QWheelEvent(pos, gpos, pixelDelta, angleDelta, btns, mods, phase, inverted)
|
return QtGui.QWheelEvent(pos, gpos, pixelDelta, angleDelta, btns, mods, phase, inverted)
|
||||||
|
|
||||||
def mousePressEvent(self, mouse_event):
|
def mousePressEvent(self, mouse_event):
|
||||||
|
Loading…
Reference in New Issue
Block a user