[Development] Contribution: Windows Stock Icons
frank.richter at gmail.com
Tue Nov 17 17:48:24 CET 2015
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).
Those extra sizes are certainly beneficial if there are unusual icon size
or scaling needs.
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.
On Tue, 17 Nov 2015 at 13:46 Benjamin TERRIER <b.terrier at gmail.com> wrote:
> For the first point I think it is a good idea.
> However the second point seems to be already taken care of. As far as
> i know, the current API for obtaining such icons is
> QStyle::standardIcon(), looking at its implementation in QCommonStyle,
> it calls QPlatformTheme::standardPixmap() for multiple hardcoded sizes
> (16x16 and 32x32 at this moment). So the returned QIcon already
> provides various resolutions.
> It might be improved by calling QPlatformTheme::standardPixmap() for
> sizes matching SHGSI_LARGEICON, SHGSI_SMALLICON, SHGSI_SHELLICONSIZE.
> 2015-11-14 14:03 GMT+01:00 Frank Richter <frank.richter at gmail.com>:
> > Hello everybody,
> > I made some (non-trivial) changes to the Windows stock icon
> > The goals were
> > 1. Use public/"modern" APIs as much as possible to obtain the icons.
> > 2. Make the various different resolutions stock icons are provided in
> > available to Qt.
> > For the first goal I changed to code to use SHGetStockIconInfo as much as
> > possible and shell item icons for some other icons; hardcoded resource
> > and the legacy IDI_ icons are only used as a last resort. (It's worth
> > mentioning that the IDI_ icons will only return "Windows 7" style icons;
> > the new Windows 8 icons you need to use SHGetStockIconInfo.
> > For the second goal I added an icon engine that looks at some raw icon
> > resource data to load all available sizes. To expose all those sizes I
> > a platform theme method to return an icon engine for a stock icon.
> > Of course I'd very much like to see this make it; however, I think that
> > before starting to submit individual patches for review maybe a bit of
> > "approach review" might be a good idea.
> > * Are these changes desireable?
> > * What do you think of returning icon engines from the platform theme?
> > * And what about the more bare-metal icon loading?
> > For the time being I uploaded the changes (in order of evolving
> > implementation) to github:
> > https://github.com/res2k/qtbase/commits/dev
> > Looking forward to your feedback,
> > - Frank
> > _______________________________________________
> > Development mailing list
> > Development at qt-project.org
> > http://lists.qt-project.org/mailman/listinfo/development
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Development