summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/android/qandroidplatformfileiconengine.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Android: check if returned bitmap is valid before useAssam Boudjelthia2025-08-181-0/+4
| | | | | | Pick-to: 6.10 Change-Id: Ief11389fa4e1b44a854b3d98c47f74d6d0d04bf7 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* JNI: add isClassAvailable for declared typesVolker Hilsheimer2025-06-191-1/+1
| | | | | | | | Convenient forwarder to QJniObject::isClassAvailable, with the class name known at compile time. Change-Id: Id527e573251256f5a4b44998fdbcefefcdc24704 Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
* Android: implement a file icon providerVolker Hilsheimer2025-06-191-0/+113
Implement QPlatformTheme::fileIcon on Android to try a dedicated file icon engine, and if that fails, fall back to the generic font-based icon engine for the "draft" icon, which is a generic icon for a document file. The QAndroidPlatformFileIconEngine uses Android's content resolver to get the mime type information object for a given mime type. To get the mime type, we can use the MimeTypeMap from android.webkit (rather than our own QMimeDatabase, which might not be available or give different results than the native map). Once we have the MimeTypeInfo (which requires API level 29), we can get the Icon, and from that again the Drawable. We store that as part of the engine instance so that we can paint it when needed. When requested, we paint it into a Bitmap using the requested size. We can then read the pixel values from that Bitmap using Android NDK APIs, and generate a QPixmap from those (via QImage). Since this is a heavy operation, we cache the QPixmap and only regenerate it if we need it in a different size. Fixes: QTBUG-134239 Change-Id: I3dab391bba8c9888446b8affbb220c67dcb43dd0 Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>