From b843214f66813fe9e461fa416a609a23e1f7b7a7 Mon Sep 17 00:00:00 2001 From: KIU Shueng Chuan Date: Tue, 29 Jun 2021 12:30:46 +0800 Subject: [PATCH] remove Qt4 mouse wheel handling --- pyqtgraph/opengl/GLViewWidget.py | 12 ++++-------- pyqtgraph/widgets/GraphicsView.py | 10 +++------- 2 files changed, 7 insertions(+), 15 deletions(-) diff --git a/pyqtgraph/opengl/GLViewWidget.py b/pyqtgraph/opengl/GLViewWidget.py index 61a7d445..6984059b 100644 --- a/pyqtgraph/opengl/GLViewWidget.py +++ b/pyqtgraph/opengl/GLViewWidget.py @@ -1,4 +1,4 @@ -from ..Qt import QtCore, QtGui, QtWidgets, QT_LIB +from ..Qt import QtCore, QtGui, QtWidgets from OpenGL.GL import * import OpenGL.GL.framebufferobjects as glfbo import numpy as np @@ -466,13 +466,9 @@ class GLViewWidget(QtWidgets.QOpenGLWidget): #self.swapBuffers() def wheelEvent(self, ev): - delta = 0 - if QT_LIB in ['PyQt4', 'PySide']: - delta = ev.delta() - else: - delta = ev.angleDelta().x() - if delta == 0: - delta = ev.angleDelta().y() + delta = ev.angleDelta().x() + if delta == 0: + delta = ev.angleDelta().y() if (ev.modifiers() & QtCore.Qt.KeyboardModifier.ControlModifier): self.opts['fov'] *= 0.999**delta else: diff --git a/pyqtgraph/widgets/GraphicsView.py b/pyqtgraph/widgets/GraphicsView.py index 036f2f05..ed73cca5 100644 --- a/pyqtgraph/widgets/GraphicsView.py +++ b/pyqtgraph/widgets/GraphicsView.py @@ -317,13 +317,9 @@ class GraphicsView(QtGui.QGraphicsView): super().wheelEvent(ev) if not self.mouseEnabled: return - delta = 0 - if QT_LIB in ['PyQt4', 'PySide']: - delta = ev.delta() - else: - delta = ev.angleDelta().x() - if delta == 0: - delta = ev.angleDelta().y() + delta = ev.angleDelta().x() + if delta == 0: + delta = ev.angleDelta().y() sc = 1.001 ** delta #self.scale *= sc