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
Change-Id: Ib8c301a19b0d7e23f1d3ebdccde2147709f3ddb3
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit 560bf5a07720eaa8cc589f424743db8ed1f1d902)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Volker Hilsheimer 2025-06-13 13:57:37 +02:00 committed by Qt Cherry-pick Bot
parent 35fe0a0b6f
commit 4a4d11c178
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);
}