[PyQt] QGraphicsView zoom demo

Nahuel Defossé nahueldefosse at yahoo.com.ar
Wed Nov 19 10:17:05 GMT 2008


El Wednesday 19 November 2008 01:35:49 Nahuel Defossé escribió:
> Hi!
> I have a DWG drawing which I converted to svg, I would like to display it
> on a QGraphicsView with zooming capabilities, scrolling seems natural to
> QGraphicsView, but I haven't found any example of zoom (I don't care if
> it's done with the mouse scroll or a piar of buttons).
It was very easy, I just had to use the method setMatrix.
matrix = QtGui.QMatrix() # It produces the identity matrix
matrix.scale( factor, factor )
graphics_view.setMatrix(matrix)

I could even attach it to the mouse scroll event :)

But now I would like to move across the graphic when I keep the mouse pressed. 
This is not as simple as zoom as far as I can see, but then again, there must 
be a Qtish way of doing it...

Regards
Nahuel




More information about the PyQt mailing list