Once PySide is not supported in Python 3.5, I have to move my application to PyQt5 (I know PyQt4 would be a better choice, but my company asked me to use PyQt5). I'm having a hard time trying to scale a QGraphicsPixmapItem.
In PySide, QGraphicsItem has a method scale(xFactor, yFactor). In PyQt5, it has a method setScale(factor).
My question is: how am I supposed to scale x and y independently?
QGraphicsItem.scale(sx, sy) is obsolete even in Qt4, so you really shouldn't be using it at all. In both PyQt4 and PyQt5, use this instead:
item.setTransform(QtGui.QTransform.fromScale(xFactor, yFactor), True)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With