For 5.14.0, a long missing feature was implemented in QtSVG, namely rendering according to the aspect ratio defined in the SVG itself: https://codereview.qt-project.org/c/qt/qtsvg/+/262813 Earlier, SVG renderihng would always ignore this, and just use the whole available painting area as target.
However, the fature was introduced as non-optional, and with no way to opt out. In hindsight, that was an error, since it caused a lot of regressions in existing code that depends on the previous behaviour. There have been a high number of bug reports.
I (aavit) have since tried to work around this by changing those render() methods that take an explicit target rect use the old behaviour, while the default render() method use the new behaviour: https://codereview.qt-project.org/c/qt/qtsvg/+/285186
But I think that this is not a satisfactory solution, since
- It still causes regressions for all users of the default render() method, i.e. most
- It makes for bad API, with a surprising difference in behavior between similar functions
- In particular, it causes surprising difference in the result if SVG image file reading whenever scaling is specified, compared to when it is not, since the SVG image IO handler uses the render-to-target-rect method in the former case but not the latter.
I see no way out of all these issues within the limits of a patch release. Hence, I suggest that we
- Remove the whole aspect-ratio feature again for 5.14.1; i.e. reverting to the pre-5.14 behavior in all cases.
- Introduce it again as an opt-in feature for 5.15. For example, by adding an optional parameter of type Qt::AspectRatioMode to all the render(...) methods.
|For Gerrit Dashboard: QTBUG-81259|
|286086,4||Revert the keep-aspectratio feature for 5.14.1||5.14.1||qt/qtsvg||Status: MERGED||+2||0|
|288027,4||Add API to enable opt-in aspect ratio feature in QSvgRenderer||5.15||qt/qtsvg||Status: MERGED||+2||0|