Details
-
Bug
-
Resolution: Invalid
-
P3: Somewhat important
-
None
-
5.7.0
-
None
Description
At the moment high-DPI support allows specifying @Nx versions of icons for loading into a QIcon on high-DPI monitors. This solution is convenient for automatically supporting both low and high DPI monitors, but assumes that several versions of the image are needed.
For SVG, the same source can be reused to render multiple resolutions, so that a single SVG file can be embedded to render an appropriate QIcon both on low- and high-DPI monitors at any desired @Nx. Unfortunately at the moment this require embedding the same SVG file multiple times, e.g. with and without a @2x suffix in the alias, leading to unnecessary increase in the binary size.
Note that there are several related but slightly different issues around SVG and scaling / high-DPI support for QIcon, including:
QTBUG-43632QIconEngine has no access to the devicePixelRatio- QTBUG-47544 Implement better highdpi handling in QImageReader
QTBUG-3084Better support for multi resolution icon filesQTBUG-53759Qt svg icon engine does not support multiple png icons- QTBUG-2198 Designer: lack of possibility to define Multi Size Icon in Action Editor
QTBUG-47544 seems like the most sensible way to address this issue, as it allows scaling the rendering of the QIcon according to the desired size but also DPI.