mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2025-01-12 18:24:58 +08:00
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.
This commit is contained in:
parent
9d3378bd3b
commit
3de105704e
@ -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…
Reference in New Issue
Block a user