From 167bcbb7aaf4dbf92da405837f4d5bb1742d6046 Mon Sep 17 00:00:00 2001 From: Ales Erjavec Date: Mon, 22 Feb 2016 11:19:24 +0100 Subject: [PATCH] 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):