Skip to content

First meeting with the Nokia Qt SDK

August 4, 2010

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.

Qt-Creator Welcome Screen

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:

5 Comments leave one →
  1. August 4, 2010 7:59 pm

    ❤ QT. Just a shame its so hard to use under visual studio when I want to compile my linux app for windows. (QT needs a licence for VS integration 😦 )

    • August 4, 2010 8:14 pm

      I’m very impressed so far at least! What about using something else than VS? Doesn’t it compile with gcc using e.g. QtCreator?
      Edit: Misread the first time around..

      • August 5, 2010 6:54 am

        It just requires a comercial licence for the Visual Studio plugin. I can however use mingw and gcc but then it wont be compiled into a “clean” windows binary. So I hope QT comes with a Visual Studio plugin + SDK for windows aimed as Open Source development. But it doesnt look like its in the pipeline yet. So now I have a QT Trunk/Base and made a Win32 branch using WIN32 API 😛

  2. August 5, 2010 8:24 am

    ‘Doh Tror jeg har sett på gale ting jeg. Etter å ha lest mer på så kan jeg bruke det på windows også, er bare VS2010 pluginen som ikke er tilgjengelig enda. Whoohoo! Så da blir det bare å kaste vekk win32 spesifikke koden min og bruke QT til så mye som mulig for x-plattform kompabilitet 😀

    • August 5, 2010 8:36 am

      Good good! Qt skrives forresten uten stor T. Ca like mange som har fått med seg det som antall folk som skjønner hva jeg snakker om hvis jeg sier “cute” 🙂

      Qt virker svært optimalt om man ønsker å utvikle for flere platformer. Om jeg skal lære meg ett gui-verktøy i mitt liv så tror jeg det må være Qt.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: