[Interest] Qt Application deployment across platforms

Rutledge Shawn Shawn.Rutledge at digia.com
Thu Sep 5 09:04:40 CEST 2013


On 4 Sep 2013, at 8:43 AM, Thiago Macieira wrote:

> On quarta-feira, 4 de setembro de 2013 06:37:07, Ramakanthreddy Kesireddy 
> wrote:
>> I would like to know if I develop a Qt application, can it be deployed
>> across platforms like linux,OSX and Android  without recompiling for
>> Specific platform like that of HTML5 application.?
> 
> No, it can't. You need to recompile per platform.
> 
> Even QML applications need recompilation because you can't have a pure QML 
> application. There's no interpreter for it, except maybe on Blackberry 10 or 
> SailfishOS.

But we should be trying to get there, IMO.  The new qml tool (just qml, as opposed to qmlscene/qmlviewer) is intended for that.  https://codereview.qt-project.org/#change,43540  It can be used as a shebang handler on Linux/Unix platforms, and as the default application to handle the .qml file type when you double-click a qml file in the file manager on all 3 desktop platforms.  We should also make sure that it can be installed as an application on Android and iOS, and that it will show a file dialog by default so you can pick your qml file if it was not given.  But AFAIK on iOS and Android it's not straightforward to put an icon on the home screen which simply points to an arbitrary file and uses the file association mechanism to launch an application to open it.  Maybe we can expect this situation to be improved later, if the vendors want us to take tablets seriously as "real computers".

Even if all platforms supported that, it's still hard to package a whole application in a single QML file, although it can be done.  Typically there are multiple QML files, images and other resources.  You can get by without icon images if you use Unicode characters for all the icons though; if you can't find suitable glyphs, you can use a dingbat font, but then the user might not have the font pre-installed.  QML could perhaps benefit from some kind of binary embedding method (base85 like Postscript has, base64 or uuencoding as in email attachments, or the like).

But usually you would tend to need some kind of bundle.  Then having an executable is only a little bit bulkier, at least until you conclude that you need to package a fixed version of Qt with it too.  Then you are better off with static Qt and compiled-in resources to make a single file which is the entire application, and is as small as possible.  Better yet, when we have the QML compiler finished you could use that.  It's a slippery slope because of the lack of a cross-platform standard for some kind of script-bundle.  That should have been solved already long ago, because there have been scripting languages for so long.  But scripts have a bad rap for multiple reasons, even though some of the reasons are irrational.  The question becomes, why do you always groan when you see that something which claims to be an "application" is written with Java or Air or VisualBasic or Python?  I know that I do; and after my experience as a Java developer I know the reasons why we used to say that groan is irrational, too.  I still prefer applications to be as small and fast and have as few dependencies as possible, which is why the QML compiler will end up being quite important, IMO.  But I also think there is a place for single-file QML utilities which can be launched by file association with the qml tool.  A QML file can be much smaller than the executable that it generates, after all.  The existence of Qt Quick Controls should make it easier than it was before.

(disclaimer: those are my opinions, not necessarily anyone else's)




More information about the Interest mailing list