PDA

View Full Version : QSvgWidget in QMdiSubWindow: how to zoom the image



khaz
27th January 2016, 11:15
Hello everyone.
I managed to add a QSvgWidget to a sub window and I was pleasantly surprised how easy it was -- with a ready svg file loaded and displayed (the svg picture/diagram was created with another Python script).
11663


{...}
self.svgPane = QtSvg.QSvgWidget('/media/vault/docs/softdev/python/pyqt/zetcode/SIDexmp.svg')
subWindow01 = mdiBox.addSubWindow(self.svgPane)
subWindow01.setWindowTitle('Svg pane')
{...}

A button for the zooming was added, however I hit the dead end. I tried zooming with


qrec = QRect(20, 20, 300, 200)
self.svgRenderer.setViewBox(qrec)

but it does nothing, but making the region qrec white.

What to do to make it actually zoom? In the end I would like to zoom the diagram with the mouse wheel, with a slider, or with +/- buttons.

I'll be grateful for any help or pointing to resources.

Best regards.