First meeting with the Nokia Qt SDK
A long time since I have written anything now, so I thought I could write my early experiences with Qt-creator, and development for the Maemo platform. Last weekend I decided I wanted to see how difficult it would be to write a "Hello World" application for the N900, using the development kit available. I would just like to point out from the get-go that my experiences with GUI programming is fairly limited. It extends to one course in Java I had about five years ago at the university. Most of it is long forgotten. What I do with computers is programming and running simulation codes, calculating physics stuff. For this it suffices to just have a script available and input/output files. No need for graphical stuff for most of what I do.
I started by installing the QtCreator and playing around with it. It is really easy to get started with. Create a new project and you are greeted with an example code consisting of an empty .ui file (Qt graphical files in XML format), a header/source for the window and a main.cpp file. Open the UI file and you are greeted with a designer, where you can add/remove buttons, lists, layouts etc, and connect them with signals/slots. I don’t think it gets much easier than this.
The image above shows the welcome screen. The Qt Creator has a nice set of features, with drop down menus of functions inside classes, at least for Qt. This helps a lot when writing your code. Below is an example of how the source code window looks.
And finally a screenshot of how the Qt Designer window looks:
In all screenshots you see the current source code of my hello world application. I called it "shoppinglist", and it basically is a list-able thing that probably wont get far. I just needed a simple concept to play around with. I also tried out Github, so you can find my source here if you are curious.
Initially I installed QtCreator from the Arch repositories, and the Maemo SDK virtual image. I then created a "standard" C++ project. To install your application you then need (from what I understood, there might be easier ways) to run the virtual image in e.g. VirtualBox, then you need to copy your project to this virtual machine (I use Dropbox for this), then you need to log into "scratchbox" inside this virtual machine, and generate/modify the debian packages. Finally you need to build the package and move the *.deb file to your mobile. This takes a while to figure out the first time, let me tell you!
A much easier way I found later on, was to download the "Nokia Qt SDK" instead, which comes complete with a mobile simulator and possibility to build for Maemo (and Symbian S60 in the Windows edition from what I could understand). What you then do is simply open a new project, select Mobile Qt Application and select where to install (let the boxes for Maemo and the simulator be checked). Then you have a one-click compile&run to get your application shown inside a simulator, as shown in the screenshot below.
If you then want to build for your phone, you simply select Maemo instead of simulator in the bottom left, and click build. It then automatically compiles for ARM architecture and creates a *.deb file of your project. This file you can then install on your phone by first getting root access (e.g. with the gainroot script), and then run "dpkg -i <debfile>".
By default the binary is installed in /usr/local/bin/ which isn’t part of the Maemo path. You also need to do some other modifications to the debian files in order to get them properly working, but at least it is a very good starting point. There are some quirks here and there, like how the simulator isn’t entirely accurate all the time, but all in all I am very pleased to see just how much easier this has gotten! Perhaps the joy for people that have seen the hard way is larger, but all in all quite impressive right? 🙂
Finally, a screenshot of my application running on my N900: