<div dir="ltr"><div><div><div><div>Hi,<br></div>on newer Windows systems some stock icons come in a wealth of sizes for various scaling needs. For example, on Windows 10 some icons are available in 11 different sizes! (Including 256x256.) Hardcoding a "small" and "large" size doesn't really do them justice (even if you'd consider the "shell" icon sizes, which may be different, but not necessarily so).<br></div><br>Those extra sizes are certainly beneficial if there are unusual icon size or scaling needs.<br><br></div>However, not all icons are available in all those sizes all the time. If Qt should be allowed to use all available resolutions, yet avoid that any synthesized sizes are used, a hardcoded list of sizes doesn't work so well. Thus I opted for the "manual resource wrangling" approach.<br><br></div>-f.r.<br><div><div><div><div><div><br><div class="gmail_quote"><div dir="ltr">On Tue, 17 Nov 2015 at 13:46 Benjamin TERRIER <<a href="mailto:b.terrier@gmail.com">b.terrier@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
<br>
For the first point I think it is a good idea.<br>
<br>
However the second point seems to be already taken care of. As far as<br>
i know, the current API for obtaining such icons is<br>
QStyle::standardIcon(), looking at its implementation in QCommonStyle,<br>
it calls QPlatformTheme::standardPixmap() for multiple hardcoded sizes<br>
(16x16 and 32x32 at this moment). So the returned QIcon already<br>
provides various resolutions.<br>
It might be improved by calling QPlatformTheme::standardPixmap() for<br>
sizes matching SHGSI_LARGEICON, SHGSI_SMALLICON, SHGSI_SHELLICONSIZE.<br>
<br>
Regards,<br>
<br>
Benjamin<br>
<br>
<br>
2015-11-14 14:03 GMT+01:00 Frank Richter <<a href="mailto:frank.richter@gmail.com" target="_blank">frank.richter@gmail.com</a>>:<br>
> Hello everybody,<br>
> I made some (non-trivial) changes to the Windows stock icon implementation.<br>
> The goals were<br>
> 1. Use public/"modern" APIs as much as possible to obtain the icons.<br>
> 2. Make the various different resolutions stock icons are provided in<br>
> available to Qt.<br>
><br>
> For the first goal I changed to code to use SHGetStockIconInfo as much as<br>
> possible and shell item icons for some other icons; hardcoded resource IDs<br>
> and the legacy IDI_ icons are only used as a last resort. (It's worth<br>
> mentioning that the IDI_ icons will only return "Windows 7" style icons; for<br>
> the new Windows 8 icons you need to use SHGetStockIconInfo.<br>
><br>
> For the second goal I added an icon engine that looks at some raw icon<br>
> resource data to load all available sizes. To expose all those sizes I added<br>
> a platform theme method to return an icon engine for a stock icon.<br>
><br>
> Of course I'd very much like to see this make it; however, I think that<br>
> before starting to submit individual patches for review maybe a bit of<br>
> "approach review" might be a good idea.<br>
> * Are these changes desireable?<br>
> * What do you think of returning icon engines from the platform theme?<br>
> * And what about the more bare-metal icon loading?<br>
><br>
> For the time being I uploaded the changes (in order of evolving<br>
> implementation) to github:<br>
> <a href="https://github.com/res2k/qtbase/commits/dev" rel="noreferrer" target="_blank">https://github.com/res2k/qtbase/commits/dev</a><br>
><br>
> Looking forward to your feedback,<br>
> - Frank<br>
><br>
><br>
> _______________________________________________<br>
> Development mailing list<br>
> <a href="mailto:Development@qt-project.org" target="_blank">Development@qt-project.org</a><br>
> <a href="http://lists.qt-project.org/mailman/listinfo/development" rel="noreferrer" target="_blank">http://lists.qt-project.org/mailman/listinfo/development</a><br>
><br>
</blockquote></div></div></div></div></div></div></div>