Ask / Submit
2

Develop application using standard Qt modules

asked 2015-07-08 00:12:15 +0300

Luca gravatar image

updated 2015-07-17 13:30:00 +0300

Hi all, I'm starting a Qt Quick application for Sailfish but I also want my app to be buildable for Android and Linux PC so I need to avoid all the Silica part etc...

I used standard QtCreator to create a new QtQuick project next I opened the project using QtCreator from Sailfish SDK. It seems to build using "MerSDK-SailfishOS-i486" kit but I can't deploy to the emulator receiving the following last lines:

23:09:18: Starting: "/home/luca/.config/SailfishBeta4/mer-sdk-tools/MerSDK/SailfishOS-i486/deploy" --rsync Fatal: No spec file found in '/home/src1//discovery2/rpm/' and couldn't make one from a yaml #1

It's clear it need some other config file but I can't find what file it need.

Is it possible to do what I'm trying to do?

Thanks

Luca

EDIT (16/07/2015) : I love Qt because I can PORT my existing application to a lot of platform without the need to know too much programming languages. Unfortunatelly I have a QtQuick application that build on Linux PC and Android phone but I can't build it on Sailfish (!?!?!). This is what I didn't expect from Jolla !!!!

EDIT2 (17/07/2015) : My QML application start with:

import QtQuick 2.2
import QtQuick.Controls 1.1
import QtQuick.Layouts 1.1
import QtQuick.Dialogs 1.1
import Qt.labs.settings 1.0
ApplicationWindow {
id: application
visible: true

Sailfish OS haven't the required modules. I expected from Sailfish OS to don't encounter that kind of problem, that's why I bought my Jolla....

edit retag flag offensive close delete

Comments

4

I think it is possible to do what you want to do, but I have to wonder whether it is worth it. Qt on Sailfish provides full access to the UI, letting you use the pulley menu system, the paging system, the covers, the resolution-independence, etc. Qt on Android, on the other hand, provides very little: No support for activities. No support for the action bar. Very limited support for themes (this was improved slightly in the most recent release). You're basically given a box in the middle of the screen for your app, and you have to do all the work of managing your app by yourself in that little box.

Honestly, given the lack of Android support, I would hate to have to create a lowest-common-denominator UI based around it. Much better to make the back-end of the app portable between systems, but create different front-ends for Sailfish and Android.

Copernicus ( 2015-07-08 00:58:22 +0300 )edit

Sure, but my app doesn't require a lot of cool graphics and I need it to be the same on every platform. To do that I'd like to "use" the power of Qt.

Luca ( 2015-07-08 10:22:14 +0300 )edit
1

Quite many people couldn't care less about "full access to the UI", but prefer portable, long term techniques. One-offs that are thrown away causing apps to be rewritten completely unnecessarily are not good for the industry, the developers or the users (why are the so few apps? Why weren't all old Qt apps ported to Jolla? Indeed.)

mvuori ( 2015-07-08 10:53:26 +0300 )edit

I guess what I'm saying is not that you shouldn't try to create a cross-platform UI in Qt; my problem is just that Qt doesn't quite deliver all the same features on all targets. Limiting your UI to just what works for Qt on Android will mean you're going to have a very constrained UI on all platforms. :(

Copernicus ( 2015-07-08 14:49:33 +0300 )edit
1

@Luca, come to #sailfishos on irc.freenode.net and we can work through it. Simply saying 'why it no work' doesn't lead to results

r0kk3rz ( 2015-07-17 10:48:35 +0300 )edit

3 Answers

Sort by » oldest newest most voted
3

answered 2015-07-08 08:24:30 +0300

updated 2015-07-17 13:29:21 +0300

Welcome to QML hell. Each platform comes with it's own (Blackberry, Jolla, Nokia used to as well, dont know about android). My suggestion is to strongly anticipate design issues by generalizing as much qml code as possible, if you go cross-platform, and have a solid background either in c++ or javascript. The consistency problem got pushed over, or better, extended from C++ to QML. Bear in mind, I believe QML to be a great scripting language, and on top of that an excellent UI language. I believe the QML language is simply not (yet) flexible enough to handle "plugin abstraction", if we can call it like that. Sure, there are ways around it, but in most cases they are ugly.

The particular issue you are seeing is caused by a requirement of the SFOS sdk; which in turn is introduced by the sw packaging format utilized by SFOS (RPM's). You basically need to add the RPM's YAML file, out of whch the SPEC file will be created, that will then be used by the rpm utilities to create the actual RPM.

Sidenote : The more I type about this, the more I realize how crazy this whole process is ;)

edit flag offensive delete publish link more

Comments

Thanks, I didn't encountered that problem developing a Qt app for Android (using Qt5 for android from qt.io) and then building it for Linux PC because the android part is added at build time from Android SDK so the code is reusable. On Sailfish it isn't the same... it seems.

Luca ( 2015-07-08 10:31:37 +0300 )edit
2

You can skip YAML, and use spec directly.

kimmoli ( 2015-07-08 11:54:08 +0300 )edit

@kimmoli You still need spec :P

@Luca code is reusable sure (assuming the design is fitted for multiplatform)

tortoisedoc ( 2015-07-08 12:33:36 +0300 )edit
3

answered 2015-07-08 10:34:06 +0300

r0kk3rz gravatar image

updated 2015-07-08 10:34:25 +0300

You might want to take a look at @MartinK 's work into Universal Components for your QML UI.

It's an attempt to make a properly cross platform QML UI.

edit flag offensive delete publish link more

Comments

1

Thanks, interesting link.

Luca ( 2015-07-08 11:04:29 +0300 )edit

I'l also add that this project is not just a proof of concept, but it is already being used "in production" by the modRana navigation system:

modRana for Sailfish OS (also available from the Jolla Store)

modRana for Android

modRana for PC (Fedora package)

All these packages have the same GUI code that uses Universal Components.

Universal Components support multiple backends, so the the applications using UC look native and make use of specific platform features where possible.

In this case the Silica backend is used on Sailfish OS and the Controls backend is used on Android and PC.

A glacier backend for the Nemo Mobile Glacier component set is also planed (pending on Nemo getting overall more stable) and also Mike Sheldon (a developer working on Ubuntu Touch) has expressed interest in writing a backend for the Ubuntu component set.

MartinK ( 2015-07-17 11:26:34 +0300 )edit
0

answered 2015-07-17 02:28:30 +0300

Copernicus gravatar image

EDIT (16/07/2015) : I love Qt because I can PORT my existing application to a lot of platform without the need to know too much programming languages. Unfortunatelly I have a QtQuick application that build on Linux PC and Android phone but I can't build it on Sailfish (!?!?!). This is what I didn't expect from Jolla !!!!

You need to remember that Qt itself changes over time. Different platforms will support different versions of Qt, and therefore, some features will not be supported on some platforms. (And Qt Quick is one of the most recent, and most volatile, features of Qt!)

If you want a Qt app to work identically on a collection of platforms, you will need to limit yourself to Qt features that are shared in common among all those platforms. Moreover, you will still need at least a minimal understanding of the environment on each platform, as each one will have different package management systems, different rules for how applications operate, and yes, unique UI issues that you will need to be aware of (even if you are attempting to avoid the native UI completely).

Qt is a wonderful tool, but it is not a panacea. :) You'll still need to do some work to port your app between platforms...

edit flag offensive delete publish link more

Comments

Given that its sold as the only true cross-platform tool, the expectation by the average qt developer (like i consider myself) is for it to actually live up to this claim. Of course there are always corner cases; but it would be great if they would provide for example guidance on how to make apps cross-platform on qt. There's a lesson to be learned here, I believe.

tortoisedoc ( 2015-07-17 09:01:25 +0300 )edit

I don't use "strange things", and I'm not a QML expert. The main QML file of my application (that I can compile in Android phone and in my Linux PC) start with:

import QtQuick 2.2 import QtQuick.Controls 1.1 import QtQuick.Layouts 1.1 import QtQuick.Dialogs 1.1 import Qt.labs.settings 1.0 ApplicationWindow { id: application visible: true

On Sailfish SDK I can't build because it hasn't the required modules...

Luca ( 2015-07-17 13:23:13 +0300 )edit

I'd recall the qt.labs module is at least missing. Of course, one option (if the module is opensource) is to compile and provide it side-by-side (if you pass me borrowing the term from win world)

tortoisedoc ( 2015-07-17 13:25:42 +0300 )edit

@Copernicus: I disagree about QtQuick being Qt Quick is one of the most recent, and most volatile, features of Qt - it was introduced as part of 4.7 back in 2010...

@Luca: On you can (and have to!) bundle all the modules you want, so as long as the module is available, you can use it. And as every application bundles its own set of Qt modules (bleh!), they can even use different Qt versions (older and stable or newest but bleeding edge).

On normal Linux distros (and fortunately Sailfish OS is quite close to a normal distro) you need to use the "system" set of Qt modules - this has the advantage of having a single set of Qt modules per OS instance which takes much less space, is easier to update and fix security issues. But if the "system" Qt is old or has missing modules, there is not much you can do as app developer.

MartinK ( 2015-07-17 16:01:07 +0300 )edit

@MartinK: Ok, yeah, QtQuick was introduced back in 2010; but Qt was introduced back in 1995. :) (And man, now I'm feeling really old...)

Copernicus ( 2015-07-17 16:29:09 +0300 )edit
Login/Signup to Answer

Question tools

Follow
2 followers

Stats

Asked: 2015-07-08 00:12:15 +0300

Seen: 965 times

Last updated: Jul 17 '15