Android/iOS: prefer files icons to come from the Icon theme

There are no icons for computer, trash, desktop, folders, files etc. on
mobile platforms. QAbstractFileIconProvider tests the
QPlatformTheme::PreferFileIconFromTheme hint, and if set, gives
QIcon::fromTheme a try with an icon name mapped to the icon provider's
icon type.

We have at least some mapping of such standard icons in the native icon
engines, and those engines would also be the right place to perform
additional platform specific look-ups of icons (i.e. for specific file
types). So as a first improvement, try to use the icon engine for file
icon provider icons.

Task-number: QTBUG-134239
Pick-to: 6.10
Change-Id: Ib8c301a19b0d7e23f1d3ebdccde2147709f3ddb3
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
This commit is contained in:
Volker Hilsheimer 2025-06-13 13:57:37 +02:00
parent 9f93ddd2f3
commit 560bf5a077
2 changed files with 4 additions and 0 deletions

View File

@ -543,6 +543,8 @@ QVariant QAndroidPlatformTheme::themeHint(ThemeHint hint) const
Q_FALLTHROUGH();
}
case PreferFileIconFromTheme:
return true;
default:
return QPlatformTheme::themeHint(hint);
}

View File

@ -140,6 +140,8 @@ QVariant QIOSTheme::themeHint(ThemeHint hint) const
return QStringList(QStringLiteral("Fusion"));
case KeyboardScheme:
return QVariant(int(MacKeyboardScheme));
case PreferFileIconFromTheme:
return true;
default:
return QPlatformTheme::themeHint(hint);
}