diff options
| author | Volker Hilsheimer <volker.hilsheimer@qt.io> | 2025-06-17 17:24:49 +0200 |
|---|---|---|
| committer | Volker Hilsheimer <volker.hilsheimer@qt.io> | 2025-06-19 10:17:54 +0200 |
| commit | 5cf2a29fd0f97db978c61396994d3449d6fcf241 (patch) | |
| tree | f65a8f4c80db15949e0f9e3606d40496534fd56f /src/corelib/io/qdebug.cpp | |
| parent | 96c61a8a07557c6762fe08856e1ab7e1cd672aed (diff) | |
Android: implement a file icon provider
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>
Diffstat (limited to 'src/corelib/io/qdebug.cpp')
0 files changed, 0 insertions, 0 deletions
