I have a small command line utility that creates an svg image based on user input. I have been trying to put together a gui using PyQt5 with an included image preview.
The problem that I am running into is that the image is stretched to fit the available space rather than preserving the aspect ratio, even with
preserveAspectRatio="xMidYMid meet" in the file. I am using QtSvg.QtSvgWidget to load the image.
self.svgPreview = QtSvg.QSvgWidget('/tmp/preview.svg')
Looking through the docs I am not seeing any way to specify that aspect ratio must be retained. Is there a better way to load the image, or am I maybe missing something?
Interestingly, the aspect ratio is preserved when using PyGtk, so I knocked together a gui that does what I want that way. But I would like to be able to solve the problem using Qt, both for my own knowledge and to have a more cross-platform friendly application.