Problem with Zoom about QGrapphicsRectItem in View in Pyside6

36 Views Asked by At

I am new to PySide6, and I have the following code:

def wheelEvent(self, event):
    factor = 1.1
    if event.angleDelta().y() > 0:
        self.scale(factor, factor)
        self.scaleFactor *= factor
    else:
self.scale(round(1 / factor, 1), round(1 / factor, 1))
        self.scaleFactor /= factor

This code is used to scale the view, but when I use QGraphicsScene().addItem() to add a QGraphicsRectItem, the item scales when I zoom in, which I do not want. How can I resolve this issue?

i dont want the item do zoom in. How can I resolve this issue?

0

There are 0 best solutions below