A couple of weeks back, I did a talk about how extend your QML application with a Qt/C++ plugin for the Ubuntu App Developer Week. The focus of this talk was really on how to write the QML and C++ code to make it work and I didn’t really get into the build system. As that was a live example I took – what I thought was – the shortest path to get something that compiles the plugin and I just created a new project with the UbuntuSDK picking one of the old style templates. That created a qmake project, and I just hooked that up to the Ubuntu QML app template somehow.
Today however, our master of the SDK (namely Zoltan) told me that there is a much easier way already which also provides seamless integration with the rest of the Ubuntu tools like click packaging and directly running it on the phone. Apparently that would have been available already back then, but I missed it. So in order to avoid other people missing out on this too I’ve updated the WhereTheIssAt example to use that template.
Here’s a quick walk through:
With the latest SDK, create a new project and select “Ubuntu -> QML Extension Library + Tabbed UI”
Once you’ve got that ready, you can jump straight into adding the Qt/C++ code. What I did is to drop the “mytype.cpp” and readd the “iss.cpp” from the previous project. Obviously that involves a small change in the backend.cpp, replacing “MyType” with “Iss”, but that’s it. A quick copy/paste of the wheretheissat.qml file replacing the generated TabbedUi sample code later, the project was again ready to run:
The biggest advantage (besides you not having to fiddle with multiple project files) is that it gives you click packaging for free. This is another big step for the SDK and makes it much easier to extent your QML app with Qt/C++ code.
I’ve pushed the code again here http://bazaar.launchpad.net/~mzanetti/+junk/wheretheissat/files