[PyQt] Yet another examples fix
Dmitry Shachnev
mitya57 at ubuntu.com
Fri Dec 6 12:40:28 GMT 2013
This time for elasticnodes.py:
Traceback (most recent call last):
File "./graphicsview/elasticnodes.py", line 348, in keyPressEvent
self.scaleView(1.2)
File "./graphicsview/elasticnodes.py", line 412, in scaleView
factor = self.matrix().scale(scaleFactor,
scaleFactor).mapRect(QRectF(0, 0, 1, 1)).width()
AttributeError: 'GraphWidget' object has no attribute 'matrix'
Patch attached.
--
Dmitry Shachnev
-------------- next part --------------
--- a/examples/graphicsview/elasticnodes.py
+++ b/examples/graphicsview/elasticnodes.py
@@ -409,7 +409,7 @@
painter.drawText(textRect, message)
def scaleView(self, scaleFactor):
- factor = self.matrix().scale(scaleFactor, scaleFactor).mapRect(QRectF(0, 0, 1, 1)).width()
+ factor = self.transform().scale(scaleFactor, scaleFactor).mapRect(QRectF(0, 0, 1, 1)).width()
if factor < 0.07 or factor > 100:
return
More information about the PyQt
mailing list