From 5388d529287bfc807ca9268d65ffbbdc4d5205b6 Mon Sep 17 00:00:00 2001 From: Ales Erjavec Date: Mon, 22 Feb 2016 10:45:29 +0100 Subject: [PATCH 1/3] Fix QHeaderView.setResizeMode monkey patch for Qt5 shim QHeaderView.setResizeMode/setSectionResizeMode has two argument overload. --- pyqtgraph/Qt.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pyqtgraph/Qt.py b/pyqtgraph/Qt.py index 3584bec0..aeb21b0a 100644 --- a/pyqtgraph/Qt.py +++ b/pyqtgraph/Qt.py @@ -172,8 +172,8 @@ elif QT_LIB == PYQT5: self.setContentsMargins(i, i, i, i) QtWidgets.QGridLayout.setMargin = setMargin - def setResizeMode(self, mode): - self.setSectionResizeMode(mode) + def setResizeMode(self, *args): + self.setSectionResizeMode(*args) QtWidgets.QHeaderView.setResizeMode = setResizeMode From 167bcbb7aaf4dbf92da405837f4d5bb1742d6046 Mon Sep 17 00:00:00 2001 From: Ales Erjavec Date: Mon, 22 Feb 2016 11:19:24 +0100 Subject: [PATCH 2/3] Fix QGraphicsItem.scale monkey patch for Qt5 Preserve the QGraphicsItem.scale() -> float overload behaviour --- pyqtgraph/Qt.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/pyqtgraph/Qt.py b/pyqtgraph/Qt.py index aeb21b0a..eb6ff25e 100644 --- a/pyqtgraph/Qt.py +++ b/pyqtgraph/Qt.py @@ -150,10 +150,18 @@ elif QT_LIB == PYQT5: pass # Re-implement deprecated APIs - def scale(self, sx, sy): - tr = self.transform() - tr.scale(sx, sy) - self.setTransform(tr) + + __QGraphicsItem_scale = QtWidgets.QGraphicsItem.scale + + def scale(self, *args): + if args: + sx, sy = args + tr = self.transform() + tr.scale(sx, sy) + self.setTransform(tr) + else: + return __QGraphicsItem_scale(self) + QtWidgets.QGraphicsItem.scale = scale def rotate(self, angle): From dddd4f51e218d05a18dd4ac7b46d6b83ff2d49ae Mon Sep 17 00:00:00 2001 From: Ales Erjavec Date: Mon, 22 Feb 2016 11:50:26 +0100 Subject: [PATCH 3/3] Remove import of PyQt5.Qt unified module Avaid unnecessary import of QtMultimediaWidgets (https://www.riverbankcomputing.com/pipermail/pyqt/2016-February/036875.html) --- pyqtgraph/Qt.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyqtgraph/Qt.py b/pyqtgraph/Qt.py index eb6ff25e..a28e814a 100644 --- a/pyqtgraph/Qt.py +++ b/pyqtgraph/Qt.py @@ -139,7 +139,7 @@ elif QT_LIB == PYQT5: # We're using PyQt5 which has a different structure so we're going to use a shim to # recreate the Qt4 structure for Qt5 - from PyQt5 import QtGui, QtCore, QtWidgets, Qt, uic + from PyQt5 import QtGui, QtCore, QtWidgets, uic try: from PyQt5 import QtSvg except ImportError: