From 4a4d11c1781912ab67c7679adf6e9a412e2be544 Mon Sep 17 00:00:00 2001 From: Volker Hilsheimer Date: Fri, 13 Jun 2025 13:57:37 +0200 Subject: [PATCH] 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 (cherry picked from commit 560bf5a07720eaa8cc589f424743db8ed1f1d902) Reviewed-by: Qt Cherry-pick Bot --- src/plugins/platforms/android/qandroidplatformtheme.cpp | 2 ++ src/plugins/platforms/ios/qiostheme.mm | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/plugins/platforms/android/qandroidplatformtheme.cpp b/src/plugins/platforms/android/qandroidplatformtheme.cpp index 99eeabac1dd..58543cecb38 100644 --- a/src/plugins/platforms/android/qandroidplatformtheme.cpp +++ b/src/plugins/platforms/android/qandroidplatformtheme.cpp @@ -543,6 +543,8 @@ QVariant QAndroidPlatformTheme::themeHint(ThemeHint hint) const Q_FALLTHROUGH(); } + case PreferFileIconFromTheme: + return true; default: return QPlatformTheme::themeHint(hint); } diff --git a/src/plugins/platforms/ios/qiostheme.mm b/src/plugins/platforms/ios/qiostheme.mm index 0b420a875ad..afee9824d6d 100644 --- a/src/plugins/platforms/ios/qiostheme.mm +++ b/src/plugins/platforms/ios/qiostheme.mm @@ -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); }