Hi,
I found myself trying to build a QML Ubuntu Touch app project that includes a qml c++ extension and I found that I some how stumble a bit along the way. So, here are some of my notes on how I got it done. Hope that helps.
Creating the project.
Using QtCreator, create a new project and select – QML Extension Library + Tabbed Touch. I found that it was easier to change the QML side of things than start with an extension and then add the whole project structure.
Build and Run your project locally
In QtCreator click on projects. In Build, I set up the build path as my project root path. In run, the executable is “/usr/bin/qmlscene” (make sure there is no spaces trailing) and then Arguments is set to “-I ../backend/modules $@ yourapp.qml”, with a working directory of “projectroot/app”
Now if you try to run your project it should build it locally and run your app. After that you are on a roll.
Build on target device
Click Ctrl+f11 should install the platform developer tools in your device. However, I how found that this lately does not work.
Instead from the terminal:
first we will need to make the image in your device writeable:
adb shell touch /userdata/.writable_image --> and reboot the phone.
then:
cd /usr/share/qtcreator/ubuntu/scripts
adb devices
./device_developertools_install <device_id>
Now you are ready to build, so back to QtCreator:
Build>Ubuntu>Build Application on Device
This should build the application with only some test problems, but the main binaries would be created. To package your app you will need to get
/home/phablet/dev_tmp/<yourapp>/backend/modules/lib<yourlib>.so
Creating a click package
create a manifest standard manifest file. Manifest.json
{
"description": "your text",
"framework": "ubuntu-sdk-13.10",
"hooks": {
"yourappname": {
"apparmor": "yourappname.json",
"desktop": "yourappname.desktop"
}
},
"maintainer": "your name<yourname@yourmail.com>",
"name": "com.ubuntu.developer.yourname.yourappname",
"title": "yourappname",
"version": "0.1",
"architecture": "armhf"
}
You will also need a yourapp.desktop file:
[Desktop Entry]
Name=yourappname
Comment=description
Exec=qmlscene -I plugin $@ yourapp.qml
Icon=icon.png
Terminal=false
Type=Application
X-Ubuntu-Touch=true
Note that Exec= has a -I plugin part to it. This is very important, will see later.
Now yourapp.json file that contains your confinement profile:
{
"policy_groups": [
"networking"
],
"policy_version": 1
}
Now time to setup a folder with all this stuff, not that the plugin folder is going to contain your lib which your are importing with -I option on the desktop file:
myproject>
-./click/
--icon.png
--manifest.json
--yourapp.json
--yourapp.desktop
--./plugin/
---./yourlib/
----lib(yourlibname).so
----qmldir
Now you are ready to build from your project root folder:
click build ./click
This should create a .click file in your project folder.
Installing in your device
adb pull your.click /home/phablet/
adb shell
su phablet
cd ~
pkcon -p install-local your.click
This should be enough, but sometimes I find that you need to restart unity:
pkill unity8
(you might need sudo)