summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/android/qandroidplatformtheme.cpp
diff options
context:
space:
mode:
authorVolker Hilsheimer <volker.hilsheimer@qt.io>2023-07-19 10:00:14 +0200
committerVolker Hilsheimer <volker.hilsheimer@qt.io>2023-11-23 19:26:50 +0100
commitf54393ba70d6dc56b201cf8ff7691a4bf04626d6 (patch)
tree5733d3d33674c35fefc604ff4f23b4a142ce34ae /src/plugins/platforms/android/qandroidplatformtheme.cpp
parentdabf8a0d899407c1aceb6e996f72c7c3e1b7679a (diff)
Add initial implementation of an Android icon engine
Try to use the Downloadable Font APIs from AndroidX to download the Material Symbols font. This would ideally allow us to add the official icon variations dynamically to the device's font cache. This works for several fonts from Google Fonts, but not for the fonts we need. So, for the time being, add a path where we consult the resource system for an embedded font file as well. Then an application can add e.g. the font file for the desired icons variation, and Qt will use those glyphs to render icons. Do this in the manual test, using cmake's FetchContent feature to download the font from Googlei's github repository. The incomplete mapping is based on the standard Material icons documentation at https://fonts.google.com/icons. We could in theory use the `codepoints` file that comes with the font files to create the mapping, but then we'd end up with platform specific icon names. Task-number: QTBUG-102346 Change-Id: Ibff3fe6d310a388e6111d983815ef0ddffb684c8 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Diffstat (limited to 'src/plugins/platforms/android/qandroidplatformtheme.cpp')
-rw-r--r--src/plugins/platforms/android/qandroidplatformtheme.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/plugins/platforms/android/qandroidplatformtheme.cpp b/src/plugins/platforms/android/qandroidplatformtheme.cpp
index 016bfddc210..d62c1758b88 100644
--- a/src/plugins/platforms/android/qandroidplatformtheme.cpp
+++ b/src/plugins/platforms/android/qandroidplatformtheme.cpp
@@ -4,6 +4,7 @@
#include "androidjnimain.h"
#include "androidjnimenu.h"
#include "qandroidplatformtheme.h"
+#include "qandroidplatformiconengine.h"
#include "qandroidplatformmenubar.h"
#include "qandroidplatformmenu.h"
#include "qandroidplatformmenuitem.h"
@@ -481,6 +482,15 @@ const QFont *QAndroidPlatformTheme::font(Font type) const
return 0;
}
+QIconEngine *QAndroidPlatformTheme::createIconEngine(const QString &iconName) const
+{
+ static bool experimentalIconEngines = qEnvironmentVariableIsSet("QT_ENABLE_EXPERIMENTAL_ICON_ENGINES");
+ if (experimentalIconEngines)
+ return new QAndroidPlatformIconEngine(iconName);
+ return nullptr;
+
+}
+
QVariant QAndroidPlatformTheme::themeHint(ThemeHint hint) const
{
switch (hint) {