mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-08-21 05:43:32 -07:00
Support fallback when selecting theme icons
Fallback icon theme are not supported everywhere. Hence we mimic signature of QIcon::fromTheme().
This commit is contained in:
parent
ddb8e4d21a
commit
2946ab7e7a
2 changed files with 9 additions and 1 deletions
|
@ -57,10 +57,17 @@ GuiIconProvider *GuiIconProvider::instance()
|
|||
}
|
||||
|
||||
QIcon GuiIconProvider::getIcon(const QString &iconId)
|
||||
{
|
||||
return getIcon(iconId, iconId);
|
||||
}
|
||||
|
||||
QIcon GuiIconProvider::getIcon(const QString &iconId, const QString &fallback)
|
||||
{
|
||||
#if (defined(Q_OS_UNIX) && !defined(Q_OS_MAC))
|
||||
if (m_useSystemTheme) {
|
||||
QIcon icon = QIcon::fromTheme(iconId, QIcon(IconProvider::getIconPath(iconId)));
|
||||
QIcon icon = QIcon::fromTheme(iconId);
|
||||
if (icon.name() != iconId)
|
||||
icon = QIcon::fromTheme(fallback, QIcon(IconProvider::getIconPath(iconId)));
|
||||
icon = generateDifferentSizes(icon);
|
||||
return icon;
|
||||
}
|
||||
|
|
|
@ -44,6 +44,7 @@ public:
|
|||
static GuiIconProvider *instance();
|
||||
|
||||
QIcon getIcon(const QString &iconId);
|
||||
QIcon getIcon(const QString &iconId, const QString &fallback);
|
||||
QIcon getFlagIcon(const QString &countryIsoCode);
|
||||
QString getIconPath(const QString &iconId);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue