From 6910e682c1434373109660cc343a3b3af7dad633 Mon Sep 17 00:00:00 2001 From: Iyad Ahmed Date: Mon, 19 Jul 2021 16:49:45 +0200 Subject: [PATCH] Fix and update - Fix non existing QPainter attribute "matrix", replaced by "transform" - Fix implicit integer conversation deprecation warnings --- src/pyqt-official/threads/mandelbrot.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/pyqt-official/threads/mandelbrot.py b/src/pyqt-official/threads/mandelbrot.py index fbeebbe..0551800 100644 --- a/src/pyqt-official/threads/mandelbrot.py +++ b/src/pyqt-official/threads/mandelbrot.py @@ -206,7 +206,7 @@ class RenderThread(QThread): g = pow(g * s, 0.8) b = pow(b * s, 0.8) - return qRgb(r*255, g*255, b*255) + return qRgb(int(r*255), int(g*255), int(b*255)) class MandelbrotWidget(QWidget): @@ -251,7 +251,7 @@ class MandelbrotWidget(QWidget): painter.save() painter.translate(newX, newY) painter.scale(scaleFactor, scaleFactor) - exposed, _ = painter.matrix().inverted() + exposed, _ = painter.transform().inverted() exposed = exposed.mapRect(self.rect()).adjusted(-1, -1, 1, 1) painter.drawPixmap(exposed, self.pixmap, exposed) painter.restore() @@ -263,10 +263,10 @@ class MandelbrotWidget(QWidget): painter.setPen(Qt.NoPen) painter.setBrush(QColor(0, 0, 0, 127)) - painter.drawRect((self.width() - textWidth) / 2 - 5, 0, textWidth + 10, + painter.drawRect((self.width() - textWidth) // 2 - 5, 0, textWidth + 10, metrics.lineSpacing() + 5) painter.setPen(Qt.white) - painter.drawText((self.width() - textWidth) / 2, + painter.drawText((self.width() - textWidth) // 2, metrics.leading() + metrics.ascent(), text) def resizeEvent(self, event):