summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/android/qandroidplatformiconengine.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Android: use the "draft" Material icon for generic filesVolker Hilsheimer2025-06-201-0/+1
| | | | | | | | | | | | | We use text-x-generic for the generic File in QAbstractFileIconProvider. Map that icon name to the symbol for "draft" in the platform icon engine. Amends 560bf5a07720eaa8cc589f424743db8ed1f1d902. Pick-to: 6.10 Task-number: QTBUG-134239 Change-Id: I4e9795a37788a073de070be322e1b66dbeb8dd46 Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
* Android: Fix some warningsUlf Hermann2024-12-131-2/+8
| | | | | | | | | | Use a static logging category where possible, and check the return value of QFile::open. Pick-to: 6.9 Change-Id: Ieda9f7874d1b88d9bfeb593243eb867d0c274e9f Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* QFontIconEngine: always initialize with a non-merging fontVolker Hilsheimer2024-12-111-1/+3
| | | | | | | | | | | | | | | | The icon engine needs to be able to rely on glyph indices belonging to the correct font, and we generally don't want the overhead of iterating through potential fallbacks if a named glyph or unicode code point wasn't found in the font. Assert in the QFontIconEngine constructor that the font we get has the NoFontMerging strategy bit set. Amends 2af58490b3d33aab8d08610939fe2b7cab4c469c. Pick-to: 6.9 Change-Id: Ib38324aebbeda956c8dd053969d6cf08f7ef3c35 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* Refactor shared code of font-based icon enginesVolker Hilsheimer2024-11-271-119/+53
| | | | | | | | | | | | Add private QFontIconEngine that renders the glyphs; the specialized engines have to specify the font, and implement the mapping of icon name to glyph sequence (i.e. a QString). Use it for the Android and Windows icon engines. Task-number: QTBUG-102346 Change-Id: I6b0f0d6bc0378ed6918ea7cfb9dcce12ac86e8ab Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* Icon engines: don't paint on a null-pixmapVolker Hilsheimer2024-07-311-2/+4
| | | | | | | | | | | If the pixmap created is null (perhaps because the size is null), then don't paint into it. It might crash as we might end up with an invalid device context. Task-number: QTBUG-127085 Pick-to: 6.8 6.7 Change-Id: I03b3beabe02f150a2970013c15842369d3a27596 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* JNI: pre-declare JNI classes for standard Java typesVolker Hilsheimer2024-06-201-3/+0
| | | | | | | | | | | | | | | | | | This avoids that we or users have to declare e.g. String or Uri in several places in Qt. This also prevents problems where multiple declarations (possibly from different headers) cause build errors. As a drive-by, remove some unnecessary type declarations (e.g. UriType, which had the same class string as Uri). To ease the submodule update process, define a preprocessor symbol that submodules can use to conditionally declare the type locally. Once the dependency update is through, the symbol can be removed and submodules can use the declaration from qjnitypes.h. Pick-to: 6.8 Change-Id: I7d96edf644a54246302b5c5cb478e66fa615e73e Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
* Font icon engines: reverse implementation to avoid pixmapsVolker Hilsheimer2024-04-041-25/+27
| | | | | | | | | | | | Draw the glyph directly in the paint() override, and use that from the scaledPixmap implementation. This avoids a pixmap creation just for drawing an icon with an existing painter. Pick-to: 6.7 Change-Id: Iece0083a3a9f3625d843bc6e9d836baf9b5d84f8 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Doris Verria <doris.verria@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Implement icon mapping for Apple, Android, and WindowsRayam Pinto2024-02-181-1/+242
| | | | | | | | | | | Not all xcb icons have a corresponding icon on all other desktop platforms, so we might want to remove those enums for which we have almost no coverage in a follow-up commit. Pick-to: 6.7 Change-Id: I8fdc64f773768ce4ed1e0050f2a3bddef976e688 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QJniArray: don't subclass QJniObjectVolker Hilsheimer2024-01-291-1/+1
| | | | | | | | | | | | | | | | | | | | QJniObject is not prepared for being subclassed (no virtual destructor), and doing so is formally UB. Instead of making QJniArray(Base) a QJniObject subclass, give it a QJniObject member and make it convertible to/from QJniObject. Existing code still works with this change, even though it removes all the inherited QJniObject APIs for accessing fields and methods. However, as the Java array classes have a very narrow and well-defined API anyway we could, if needed, add those as C++ member functions instead of going through calling-by-string. Found during API review. Pick-to: 6.7 Task-number: QTBUG-119952 Change-Id: Ic4437116eed5e15226449bdabe48ab657cb14dc3 Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* Simplify new QIcon ThemeIcon constants and APIVolker Hilsheimer2024-01-261-12/+12
| | | | | | | | | | | | | | | | | | | | Originally we thought that exposing the string literal through the API would be useful for people that want to know what icon they will get when using a specific constant. But since the mapping from platform independent icon name to platform specific icon name is anyway hidden in the engine implementation, this is no longer useful. Based on header review comments, simplify this by making the ThemeIcon list of constants a scoped enum. If it's really useful for e.g. designers to know which exact icon they get on a specific platform, then we could, in a future release, add a static QIcon::themeIconName API that returns the platform specific icon string for a ThemeIcon constant. Pick-to: 6.7 Change-Id: I231eb98fefb4ac82d38209b4e1257bb3caadeb08 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* QIcon: harden font file discovery in Android icon engineVolker Hilsheimer2023-12-081-7/+23
| | | | | | | | | Amend f54393ba70d6dc56b201cf8ff7691a4bf04626d6 by trying more font file candidates, and don't try to download fonts if the query is pointing at a resource. Change-Id: I3fffc6fb3faa45b95540ebdf6cdf8ee4a49ebd78 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* QIcon: clean up Windows and Android icon enginesVolker Hilsheimer2023-12-071-24/+24
| | | | | | | | | | | | Use good old QString for the list of glyphs, and just render what we get. The use case where we need to draw multiple symbols on top of each other is (for now) academic, and we can support emojis just with QString. Proof the latter point by mapping "banana" to the respective emoji. Change-Id: I8005a99f015e6eb2a2a635f9d892163f2008a673 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Add initial implementation of an Android icon engineVolker Hilsheimer2023-11-231-0/+357
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>