Browse Source

Do not resize SVG icons

An icon which is loaded from SVG file can be rendered in any size and
resolutions natively. We were generating 16x16, 24x24, and 32x32
pixmaps, and not appending but creating new icon. Therefore for SVG
icons we effectively were reducing their quality.

If icon already contains 7 (or more) sizes (16 to 256 px) we do not
resize it anymore.
adaptive-webui-19844
Eugene Shalygin 8 years ago
parent
commit
3de105704e
  1. 7
      src/gui/guiiconprovider.cpp

7
src/gui/guiiconprovider.cpp

@ -88,6 +88,13 @@ QIcon GuiIconProvider::getFlagIcon(const QString &countryIsoCode) @@ -88,6 +88,13 @@ QIcon GuiIconProvider::getFlagIcon(const QString &countryIsoCode)
#if (defined(Q_OS_UNIX) && !defined(Q_OS_MAC))
QIcon GuiIconProvider::generateDifferentSizes(const QIcon &icon)
{
// if icon is loaded from SVG format, it already contains all the required sizes and we shall not resize it
// In that case it will be available in the following sizes:
// (QSize(16, 16), QSize(22, 22), QSize(32, 32), QSize(48, 48), QSize(64, 64), QSize(128, 128), QSize(256, 256))
if (icon.availableSizes(QIcon::Normal, QIcon::On).size() > 6)
return icon;
QIcon newIcon;
QList<QSize> requiredSizes;
requiredSizes << QSize(16, 16) << QSize(24, 24) << QSize(32, 32);

Loading…
Cancel
Save