[Interest] Native UI on Android (without QtQuick)

Ian Monroe ian at monroe.nu
Tue Nov 18 23:37:45 CET 2014


On Tue, Nov 18, 2014 at 7:13 AM, Attila Csipa <qt at csipa.in.rs> wrote:

> HI,
>
> It turns out you can do a fully functional (ie. not a subset) Android UI
> just by using QAndroidExtras and it's QAndroidJNIObject class from C++,
> without ever touching QML or QtQuick. At this point, this is just an
> exercise, for details see
>
> http://achipa.blogspot.com/2014/11/native-ui-in-qt-on-android-without.html
>
> but there are actually some advantages (especially if you have a
> super-simple UI or are dealing with embedded) taking this less-traveled
> path:
>
> Advantages to such a Controls-less approach are:
>
> Full UI functionality available, regardless of Qt version
> Styling always latest platform-native
> Native UI performance
> Smaller APK size (currently at least ~5MB less, potentially ~7MB)
> Smaller memory footprint (35MB less for Hello world, more as app
> complexity increases)
>
> Disadvantages:
>
> Not cross-platform
> Significantly increased code complexity, especially with more complex UIs
> Harder to debug due to dynamic nature and lack of tooling support
>
> Let me know if you have or are aware of a project that would benefit
> from such an approach (or would be interested in, say, a QML-wrapped
> native layer).
>

This could make more sense. You certainly need some more wrapping, even if
it's at the C++ level. Otherwise why are you using Qt at all?

If you can use QAbstractItemModel with a native Android widget easily, then
it becomes interesting.  C++ is the only thing all platforms - WinRT, iOS,
Android, win32, Linux - have in common, which is what Qt is leveraging of
course. Being able to use native UI on the frontend while keeping all the
business logic in a crossplatform C++ library would be an interest
trojan-horse way to simplify crossplatform development (eg the project
managers don't need to know, they can be assured that native toolkits are
being used.)

Ian
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20141118/72128175/attachment.html>


More information about the Interest mailing list