Qt 6.3.1 Windows icons are upscaled at 125% scaling instead of downscaled from @2x
-
Hello,
When looking at my application at 125% scaling on Windows I notice a drop in quality of my icons because they are upscaled from the 100% image. Results would be better if they were downscaled from the 200% image (defined with the @2x name suffix).
In the QIcon example documentation: https://doc-snapshots.qt.io/qt6-6.3/qtwidgets-widgets-icons-example.html it's mentioned that "For any given mode/state combination, it is possible to specify several images at different resolutions. When rendering an icon, QIcon will automatically pick the most suitable image and scale it down if necessary. (QIcon never scales up images, because this rarely looks good.)" so I would assume it would downscale my 200% image instead of upscaling my 100% image.
I'm just using a default QIcon constructor: QIcon(":/Framework/Images/Transform-Simple.png") with the filename, and it's interesting to note that it will downscale the 200% image at 175% scaling, so it does find my 200% images.
I've also checked the Qt code, and in qicon.cpp there's a static function bestSizeScaleMatch(...) which finds the closest scale image to use as the image to scale to the correct resolution. This function seems contradictory to saying it will always downscale as it will pick the image closest to the current scaling (so in my case the 100% image is closer to 125% and it upscales that).I don't know if I misinterpreted that statement, if there's something else I should take in account for my QIcons, or if I should find a workaround for this bestSizeScaleMatch function.
Thanks in advance for any advice.
-
It's probably the same as https://bugreports.qt.io/browse/QTBUG-90634