# How to deploy Qt/QML application without SDK?

I already had a try with coding some small applications with Qt/QML on Ubuntu with the packaged QtCreator or with the official installer

By the way, I can imagine that using Silica components or using SailfishOS API in a software can't be done without using the SDK. But what if we are just using basic QtQuick components?

Do we really need to install an other QtCreator for each platform we want to deploy on, or is there something to do in a "vanilla" QtCreator to make it deploy on a Jolla phone ?

edit retag close delete

You need to cross compile for ARM, and you need the same environment (packages etc.) that are installed on the phone. Using a VM for this is really a no-brainer, so I don't really get your point. If it's only QML, you can probably "deploy" directly (make an RPM package), though you won't be able to test without the Silica components.

( 2014-10-15 22:37:09 +0200 )edit

MartinK, could you click on "convert to answer" so I could vote for it ? :)

( 2014-10-19 20:38:08 +0200 )edit

@charlycoste: Sure! :)

( 2014-10-19 23:28:57 +0200 )edit

Sort by » oldest newest most voted

I'm using PyOtherSide for modRana, so my application is just Python & QML. As I don't have to compile anything, I just rsync the source files to the Jolla and start the application with qmlscene.

Haven't used the SDK in ages as I don't need it at all. :)

As for debugging the application on desktop - I'm using Universal Components, which support dynamic backend switching (Silica/QtQuick Controls) so I can run the same modRana source code on my desktop and on my Jolla and it always looks native. :)

Update - where to get qmlscene ?

The qmlscene utility is not installed by default, but can be easily acquired by installing the qtchooser and qt5-qtdeclarative-qmlscene packages:

pkcon install qtchooser qt5-qtdeclarative-qmlscene


or (as root):

zypper install qtchooser qt5-qtdeclarative-qmlscene

more

I've been wishing for something like Universal Components and didn't know it exists, thank you for mentioning it!

( 2014-10-23 21:35:49 +0200 )edit

@Camil B Thanks! It demonstrates the concept works and while it is still incomplete, it can be improved thanks to being open source. :)

( 2014-10-23 22:39:29 +0200 )edit

That is so great. I always found Sailfish development to be cumbersome (no offence to Jolla) with two VMs (or one vm + phone). It seems now apps can be continuously developed (similar to web apps) on your desktop and only tested on Sailfish VM/device. @MartinK would you mind giving us some minimal-viable example of a QML app with Python (and PyOtherSide) that executes on desktop and the device alike? I think this kind of "reference template" for an app would really beneficial to the community. Usually everyone invents their own project structure etc. and it's better to use good patterns.

( 2015-04-18 12:08:11 +0200 )edit

Warning: by following this tutorial you will drill a hole in the root filesystem, which is a security issue. Just so you know.

Here's how I do the programming (just learning QML at the moment, so I needed a procedure for very quick prototyping without the SDK). This is an example for a hypothetical application, called Oranges. We will put its pure-QML code in a nicely accessible place, and then call it in the command-line. So here it is:

Create folder /home/nemo/Devel. This folder will hold all your pure-QML projects. Inside /home/nemo/Devel, create a folder Oranges, to hold your project. Then create the following folders:

/home/nemo/Devel/Oranges/qml
/home/nemo/Devel/Oranges/qml/pages
/home/nemo/Devel/Oranges/qml/cover


Inside /home/nemo/Devel/Oranges/qml, put the file Oranges.qml. This is the main file of your application, and must have the same name as your application - it's a rule in SailfishOS (maybe MeeGo too?). Inside Oranges.qml, copy this:

import QtQuick 2.0
import Sailfish.Silica 1.0
import "pages"

ApplicationWindow
{
initialPage: Component { MyFirstPage { } }
cover: Qt.resolvedUrl("cover/CoverPage.qml")
}


Of course, this is the standard ApplicationWindow definition, like in any SailfishOS app. It's all you need. Don't forget to also create the QML files /home/nemo/Devel/Oranges/qml/pages/MyFirstPage.qml, and /home/nemo/Devel/Oranges/qml/cover/CoverPage.qml, and put nice things in them to impress your users.

Now the best parts:

1. Open the terminal, and go root.
2. ln -s /home/nemo/Devel/Oranges /usr/share/Oranges (you will do this for every project you put into your Devel folder. This is a security hole, since any app can maliciously overwrite your files in /home/nemo/Devel/Oranges with bad QML code, and that code will be executed by SailfishOS without discrimination)
3. Ctrl-D to exit root.
4. Now the fruity magic: sailfish-qml Oranges and your app starts! Or crashes when it has bugs, and QML will log everything to the terminal, of course.

What you achieved is this: now you have the project easily editable in your home and you can run it in the proper sailfishy way. sailfish-qml will run your QML files as if they were a real app, respecting all conventions and giving you all the privileges that a full C++ SailfishOS app would have. Well, at least all that's available through the QML API. Moreover, your source is on your phone all the time, so you can edit it easily. If you have Linux + KDE, you can transparently access the phone's filesystem through SFTP (did you know that it supports SFTP, and it's enabled by default? it's awesome! :D) like it would be mounted as a partition, thanks to KDE's awesome KIO framework. So you edit the files directly on the phone, live, with your favourite editor.

If someone could give some instructions about how to create a custom Launcher icon for Oranges, that would be awesome.

Keep the dry side up and the wet side down!

more

Launchers are created with a Oranges.desktop file located in /user/share/applications. They are text file following the Freedesktop specification. They contain the name of the application (in several languages if provided), the way to run it, an icon... For instance :

[Desktop Entry]

Type=Application

X-Nemo-Application-Type=silica-qt5

Name=Oranges

Icon=Oranges

Exec=sailfish-qml Oranges

And an icon should be placed in /usr/share/icons/hicolor/86x86/apps/Oranges.png being of a size 86x86 pixels.

( 2014-11-27 23:33:09 +0200 )edit

Does this guide still applies with Vaarainjarvi?

( 2015-01-14 04:09:21 +0200 )edit

Why no just run the application with qmlscene ? Unlike the very limited sailfish-qml launcher it can launch a QML applications from any path:

qmlscene /home/nemo/whatewer/app.qml


I'm not sure if qmlscene is included by default, but rpm -qf /usr/bin/qmlscene tells me it is provided by the qtchooser package.

more

2

I noticed sailfish-qml being used by Python-based apps, like gPodder, I think. If anyone could point out the difference between qmlscene and sailfish-qml, it would be great. Maybe qmlscene doesn't support the active cover with actions? Or maybe Harbour compatibility? There must be a reason for sailfish-qml to exist. What other limitations of it do you know of? Though maybe qmlscene should be preferred, if it can run from anywere.

( 2014-10-23 22:27:57 +0200 )edit
1

@Camil B Yeah, I also use sailfish-qml in my desktop file, but during development I use the more full featured qmlscene. As for the differences, I only know sailfish-qml is based on libsailfishapp and might use something called booster for faster startup. It would be indeed interesting if someone more versed in sailfish-qml internals stepped in and pointed out the differences from qmlscene. BTW, I've recently opened a couple of bugs/RFEs on sailfish-qml on Github:

[bug] --help and --version options are interpretted as input

[RFE] add support for appending to QML import path to sailfish-qml

[RFE] support for passing arguments to applications in sailfish-qml

( 2014-10-23 22:36:25 +0200 )edit

According to the Harbour FAQ, the .desktop file should use sailfish-qml. But it doesn't say why... Anyway, I'm giving up on it during prototyping - qmlscene looks like a better option when you just do the coding. Production stuff should stick to sailfish-qml, because Jolla says so and we don't know enough to argue :)

( 2014-10-23 22:40:39 +0200 )edit
2

qmlscene doesn't seem to allow Cover Actions. The cover of a QML app launched with qmlscene is just black, with the text My Cover, but no actions. Also, when closing the app, it exits with segmentation fault.

( 2014-11-01 10:55:57 +0200 )edit

I discovered something interesting thanks to an other question : https://together.jolla.com/question/58459/source-code-of-calender-app/#post-id-58470.

When we install an application, QML code goes to /usr/share/[application_name]. So, at least, we can deploy once the application with the SDK, then edit QML files (need to be root, so type: devel-su and use the same password as nemo)

But that's a solution only for QML edition. Cannot be used to edit C++ code, but at least, we can use every installed QML components.

more

I have written a small Makefile and a template that packages/deploys a qml/pyOtherSide app:

https://github.com/dasimmet/Sailfish-Python

It uses fpm to build a rpm package in /tmp/fpm-jolla and sends it to your jolla/emulator via ssh, where it is installed with pkcon. I still have to look into what it takes to make them harbour-conform, but for development purposes, it works quite nicely.

more