From 3de105704ef5c43944d190f30aad8f7668d58106 Mon Sep 17 00:00:00 2001 From: Eugene Shalygin Date: Wed, 18 Jan 2017 10:21:41 +0100 Subject: [PATCH] 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. --- src/gui/guiiconprovider.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/gui/guiiconprovider.cpp b/src/gui/guiiconprovider.cpp index 55e71194f..2a7ab9cd9 100644 --- a/src/gui/guiiconprovider.cpp +++ b/src/gui/guiiconprovider.cpp @@ -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 requiredSizes; requiredSizes << QSize(16, 16) << QSize(24, 24) << QSize(32, 32);