
Qt for Android better than ever before - jcelerier
https://www.kdab.com/qt-for-android-better-than-ever-before/
======
pepijndevos
I have in the past developed a fairly large (proprietary) Qt application that
used the same codebase on Linux, Windows, and Android. I would say Windows and
Android are tied for compile hell.

This update looks really neat, and may solve some problems for some people.
But personally my biggest gripe with Qt is qmake.

When you are doing Android, lots of resources assume Gradle, and lots of Qt
stuff assumes qmake. Neither is ideal if you're dealing with other libraries
like gstreamer, or even worse: proprietary libraries compiled using an old
NDK.

So I ended up writing my whole build system in cmake, which made builds on
Windows and Linux a lot saner, but made Android a living hell. I'd love to see
better support in Qt for actual sane build systems you can use with real world
third-party libraries, because qmake is not it in my experience.

~~~
scrollaway
I read somewhere a few months back that qt is dropping qmake in favour of
cmake in the medium term. And everyone rejoiced.

~~~
amelius
That's a step in the right direction. The next thing would be to drop the
compiler extensions (signal/slots macros) in favor of modern C++.

~~~
jcelerier
There is sadly no reflection nore code generation yet in C++ so that cannot
work without lots of ugly macros.

------
tipsysquid
I've been getting more and more interested with qt development. As a linux
user, I'm exhausted from the bloat and cycle stealing electron apps ( with
VSCode being a notable exception to this rule). But more recently, the idea of
writing one app in Qt, running it everywhere between Android, a Librem 5, and
desktop platfoms is really exciting.

~~~
mehhh
That was the main idea behind Pyre-Qt, but dynamic media resizing is not well
supported in Qt unless you pull in a web view (at which point you've recreated
Electron).

[https://pyre.chat](https://pyre.chat)

One fork of Pyre does this using a web view, and it fixes the media scaling
bug, but what is the advantage over Signal Desktop at that point (besides
being a tray icon & having native integration)?

Edit: Capitalization

~~~
panpanna
What about qml?

------
dTal
I've been looking for a way to write cross-platform apps without a painful
language or build hell, and I've just come across EQL5-Android, which binds Qt
for Android with Embeddable Common Lisp. I don't know Common Lisp, but I like
Scheme and I'll try anything to avoid Java or C++. So far it's looking very
slick...

[https://gitlab.com/eql/EQL5-Android](https://gitlab.com/eql/EQL5-Android)

~~~
akavel
You may be also interested in my hobby project, a WIP tool for writing Android
apps in Nim, _completely without Java and /or Android Studio_:
[https://forum.nim-lang.org/t/4840](https://forum.nim-lang.org/t/4840). I'm
slowly pushing it further since the initial PoC announcement above, but it's
not yet there for a second phase of loud publicity. Still, you may like to
watch for releases on GitHub. As you can see from this project, I'm also
desperate to avoid Java or C++... ;)

------
stefan_
If you were to make a list, building the damn thing would probably come last.
Go to the store on your favorite platform, search "The Qt Company" and try
some of their demo apps.

It's all complete dog. Looks terrible, behaves worse. It's like Flutter except
with 1/100th of the developer firepower to make sure it behaves natively.

My personal favorite is the input controls. They haven't freaking implemented
copy and paste! It is all just beyond unusable.

~~~
mkl
> My personal favorite is the input controls. They haven't freaking
> implemented copy and paste! It is all just beyond unusable.

What are you talking about? Qt Widgets and Qt Quick Controls (QML) have always
supported copy and paste.

------
allenskd
I don't know how Qt & Android fare these days... I know it was quite a hassle
to create background services when I first tried to get into it and there was
no definitive answer as I think it was still on the roadmap to add it
(perhaps?).

Qt is amazing and so is QML. I still found QML JavaScript engine utilizing a
lot of memory back then as well and I don't know if it has been fine-tuned
these days.

~~~
oever
Qt6 will have faster and lower footprint QML because JavaScript will be
optional.

Also QML will gain type checking.

~~~
dkersten
Is there a timeline or target release date for Qt6 yet?

~~~
jcelerier
[https://www.qt.io/blog/2019/08/07/technical-vision-
qt-6](https://www.qt.io/blog/2019/08/07/technical-vision-qt-6)

TL;DR : "we’re aiming to have Qt 6.0 ready for a first release by the end of
2020."

~~~
dkersten
Thank you! I read that page, but I guess I didn't read it properly.

------
Buttons840
> The user of your application has to be able to re-link your application
> against a different or modified version of the Qt library. With LGPLv3 it is
> also explicitly stated that the user needs to be able to run the re-linked
> binary on it’s intended target device. It is your obligation to provide the
> user with all necessary tools to enable this process. For embedded devices,
> this includes making the full toolchain used to compile the library
> available to users. For parts licensed under LGPLv3 you are obliged to
> provide full instructions on how to install the modified library on the
> target device (this is not clearly stated with LGPLv2.1, although running
> the application against the modified version of the library clearly is the
> stated intention of the license).

Source: [https://www.qt.io/faq/](https://www.qt.io/faq/)

Using the LGPL licensed Qt on Android looks difficult. Although, I suppose
compliance would not be much work in comparison to the development of a
significant app.

Has anyone else had to go through compliance with the above? How did you do
it?

~~~
wtracy
Typically you get a commercial license for mobile development. That's the only
way to distribute Qt apps through Apple's store.

[https://www.qt.io/start-up-plan/](https://www.qt.io/start-up-plan/)

I thought there was a small business license available for a one-time fee of
$100, but now I only see recurring subscription options.

------
mherrmann
For people new to Qt: It's a cross-platform GUI framework. It's written in C++
but can also be used from (among others) Python. If you're interested in
examples, see for instance [https://build-system.fman.io/pyqt-
tutorial](https://build-system.fman.io/pyqt-tutorial) (I'm the author).

~~~
quietbritishjim
> Not Found

> The requested URL /pyqt-tutorial was not found on this server

~~~
superpermutat0r
[https://build-system.fman.io/pyqt5-tutorial](https://build-
system.fman.io/pyqt5-tutorial)

5 missing

------
mangosherbet
Qt is a great toolkit and I've messed around with it on Android on and off
since Lighthouse. One thing I want to point out is that Qt is LGPLv3 and (in
my non-lawyer opinion) this is a pain point on restricted application
environments like the Google Play store on Android. Its not clear to me that
you can comply with a user request to get access to replace or modify LGPL'd
software in your application.

~~~
wtracy
That issue goes away if you purchase a commercial license, which is quite
affordable.

That's the only way to legally distribute Qt apps through Apple's app store.

~~~
joezydeco
Thankfully it's a one-shot license for "mobile" development as opposed to
"embedded" development, which needs a paid license _per unit_.

------
krn
What are the technical reasons to prefer Qt over JavaFX[1]? Even Bitwig
Studio, which is a C++ audio application, went with JavaFX for its cross-
platform UI. It can also be written in React-like declarative style[2], which
is much easier to maintain.

[1] [https://openjfx.io/](https://openjfx.io/)

[2] [https://github.com/cljfx/cljfx](https://github.com/cljfx/cljfx)

~~~
yoz-y
You can write in C++ so it's much easier to re-use libraries in C/C++.

~~~
The_rationalist
Electron does allow to use c++, what make QT c++ more practical for business
logic?

~~~
ahartmetz
The things that are missing in standard C++: Unicode, SQL, filesystem (kind of
fixed in C++20 or so), serialization, network protocols, JSON, XML, an event
loop(!), signals and slots, a thread pool, compiled-in resources, runtime
plugin support, etc

~~~
The_rationalist
Thanks for exemplifying! Nit: filesystem is fixed in C++17.

~~~
yoz-y
I’d add that passing objects is also way easier when you do not need to bridge
languages. And you avoid gyp.

------
neogodless
For those new to hearing about Qt / Qt for Android:

\- [https://doc.qt.io/qt-5/android.html](https://doc.qt.io/qt-5/android.html)

\- [https://www.qt.io/](https://www.qt.io/)

> Qt for Android enables you to run Qt 5 applications on devices with Android
> v4.1 (API level 16) or later.

> One framework. One codebase. Any platform.

------
satysin
Qt for Android has always looked pretty good but I never see it used. Could
someone link a few real-world apps developed with Qt for Android?

~~~
distances
I had a Qt app for MeeGo and Symbian, and later ported and released it to
Android too. I didn't like the use experience, so I rewrote in native Android
some five years ago or so. Code was fine, but the UI was a lot of work and
still felt a bit out of place.

~~~
pjmlp
That was my experience back in Qt 5.4 (so a while ago).

So I ended up keeping the logic in C++ with native views.

------
benmcnelly
That is great, love it how sometimes things like this are stumbled upon by
working outside what you are used to.

------
app4soft
Is there Qt-app template in Material style for Android in source form?

------
baybal2
I'm very disappointed that native GTK+ on Android went nowhere

------
cocochanel
No it's not.

~~~
MaxBarraclough
You're being downvoted for making a contrarian comment with no substance.

If you had a negative experience with Qt for Android, go ahead and share it.

~~~
Gibbon1
Now there are three comments with no substance.

