From d5e516ad528151b7bd8e78f79c90c4c52c425fb3 Mon Sep 17 00:00:00 2001 From: KIU Shueng Chuan Date: Mon, 8 Feb 2021 08:22:19 +0800 Subject: [PATCH 1/2] restrict PyQt6 QEvent.type() monkey patching to 6.0.0 The bug that this workaround was for has been fixed in PyQt6 6.0.1. However our feature test for the bug was faulty and triggers positive for PyQt6 6.0.1. In other words, we would be needlessly monkey patching where it wasn't needed. --- pyqtgraph/Qt.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/pyqtgraph/Qt.py b/pyqtgraph/Qt.py index ebd81394..66751d77 100644 --- a/pyqtgraph/Qt.py +++ b/pyqtgraph/Qt.py @@ -387,10 +387,7 @@ if QT_LIB == PYQT6: # PyQt6 6.0.0 has a bug where it can't handle certain Type values returned # by the Qt library. - try: - # 213 is a known failing value - QtCore.QEvent.Type(213) - except ValueError: + if QtCore.PYQT_VERSION == 0x60000: def new_method(self, old_method=QtCore.QEvent.type): try: typ = old_method(self) From 665988dc4f7a6b6d57336719801b47c3662c47d0 Mon Sep 17 00:00:00 2001 From: KIU Shueng Chuan Date: Tue, 26 Jan 2021 10:16:56 +0800 Subject: [PATCH 2/2] remove spinbox return key workaround the code being removed was committed in 2012. the reason for the workaround no longer exists. the reason this code is under scrutiny is because while porting to PyQt6, calling ev.type() triggered a bug in PyQt6 6.0 --- pyqtgraph/widgets/SpinBox.py | 6 ------ 1 file changed, 6 deletions(-) diff --git a/pyqtgraph/widgets/SpinBox.py b/pyqtgraph/widgets/SpinBox.py index 55e112da..d9156777 100644 --- a/pyqtgraph/widgets/SpinBox.py +++ b/pyqtgraph/widgets/SpinBox.py @@ -113,12 +113,6 @@ class SpinBox(QtGui.QAbstractSpinBox): self.editingFinished.connect(self.editingFinishedEvent) - def event(self, ev): - ret = super().event(ev) - if ev.type() == QtCore.QEvent.KeyPress and ev.key() == QtCore.Qt.Key_Return: - ret = True ## For some reason, spinbox pretends to ignore return key press - return ret - def setOpts(self, **opts): """Set options affecting the behavior of the SpinBox.