Friday, March 4, 2011

QtMobility 1.1.1 and 1.2TP on Maemo

The Qt SDK 1.1 Tech Preview's Maemo target unfortunately ships with only QtMobility 1.0.2, however this should not discourage developers wishing to explore new functions (or, well, simply get rid of old 1.0.x bugs). Thus, if you're doing something for Maemo Extras, there is a simple way of changing which version of mobility do you wish to use. Extras-devel already had builds of 1.1.0 but the news with this latest 1.1.1 release is that

  • works with QtSDK, too, not just Scratchbox
  • works on Windows, too !
  • plenty of bugfixes
  • will be available in Extras proper (not just devel)

To make your project use 1.1(.1) on both Maemo and Symbian you just need to do:

 maemo5 { 
  CONFIG += mobility11
} else {
  CONFIG += mobility
To reiterate - this is only for Extras-bound software, people targeting the Ovi store with Maemo still have to use the old 1.0.2. The exact steps and gory details of getting Mobility 1.1.1 and 1.2TP into your development environment can be found here.

Monday, February 7, 2011

Living on the (nightly QtCreator) edge

Sometimes even a Tech Preview or Beta of the QtSDK or QtCreator seems too far behind, especially when you see that something that bugs you has already been resolved in the mystical master branch. My favourite is for example that I can start my Maemo apps without going through the packaging step. If you are in similar shoes, and you (and your projects) are not afraid to be mentally traumatized, cut and maimed by the bleeding edge (you have been warned !), you can always grab the stuff from gitorious. Except, building QtCreator can be a drag, especially if you're not on per tu with gitorious. This brings us to the crux of the matter:

The QtCreator nightlies

Yes, I pretty much made a blog post and a long intro just to give you this link - lame, I know :) You have Windows, Mac, Linux32 and Linux64 binaries there. Note that sometimes a particular platform might be missing due to build failures - in that case just go ../ from the latest directory and check previous day or two. The general advice is to install the nightly in a different directory (i.e. not within the QtSDK). A special note is that QtCreator keeps some of it's settings as global, which is a double-edged sword - on one hand it makes easier to use the same Qt versions and rootstraps in both the stable and nightly QtCreators, but also can lead to config pollution if going back-and-forth between various versions which might require an SDK reinstall (you have been warned - again !).

Keep the Qt applications flowing and have Qt fun(k) !

Saturday, February 5, 2011

Generating compatible source packages from QtCreator

I hear this question every now and then - how do you avoid going to the command line and/or scratchbox to generate your uploads for Extras ? There are plenty of ways of doing it (simple and not-so-simple), with some guidance even, but here's the 'how I do it' post:

First of all, you'll need a fairly recent QtCreator. Today, that means the QtSDK 1.1 Beta. When you have that installed, all you need to do to get your .source package is add a custom build step in Projects -> Maemo -> Build:

The stanza you need is a bit of MADDE/debian magic, but fairly simple:

Windows folks - don't panic, you can do this, too, just use \QtSDK\Maemo\4.6.2\wbin\mad.cmd as the command. For the lazy typists, here's a plaintext for copy-paste:

dpkg-buildpackage -sa -S -uc -us

That's all there is to it ! Whenever you want to publish something to, you just tick the 'Enable custom process step' and voila, after the build you'll have your .tar.gz, .changes and .source files good to go, no console or scratchbox tinkering required.

A few caveats, though:

  • This will work only after you have successfully built a binary package (deb) at least once (as that generates some of the necessary files - like changelog)
  • The Maemo/4.6.2 directory name is a known bug. In reality it contains Qt4.7, don't let that confuse you
  • If you want to sign your packages, remove the "-uc -us" from the command arguments (make sure you have previously set up your RSA keys correctly, of course).

Have Qt fun(k) and see you in Extras !

Thursday, October 28, 2010

Fresh from the oven: Qt extras for Ubuntu users !

The nice thing about Qt development is that you can get a taste of the latest bleeding edge technologies (QML, Qt Components, MTF) if you take a peek at what's going on at gitorious. The downside is, sadly, that you either need specialized SDK installs or suffer building all those packages from source, packaging them, and not blowing up your install in the process. This can be a time-consuming and daunting task. Well, if you have Ubuntu Lucid or Maverick, you're in luck as there is a shortcut to having a quick taste of the bleeding edge: the Forum Nokia Qt PPA, containing all the new and shiny goodies in a convenient form, compiled for desktops. Read on how to get the fresh-from-the-oven stuff !

Foreword: there a few points that differ in installing under Lucid and Maverick due to Qt version differences. The instuctions will reference Maverick by default and will have 'Lucid notes' for Ubuntu Lucid users.

First you'll need to add the PPA to your Ubuntu:

sudo add-apt-repository ppa:forumnokia/fn-ppa

If all goes well you should see something like:

PPA up and running ! Now, to install the packages from the repository:

sudo apt-get update
sudo apt-get install qt-components-dev libqtm-dev libmeegotouch-dev qt4-qmlviewer

should result in a flurry of packages (Lucid note: use qt4-47-qmlviewer instead of qt4-qmlviewer):

This will install all the necessary dependencies you need for development from the PPA. That's all there is to it ! (Lucid note: you will get automatically get an install of Qt4.7 in /opt/qt4/ (these are the libqt4-47-* packages). I really tried to keep the stuff as independent from the system Qt stuff as possible so it could be updated/removed without hassle.

All this is cool but how do you use this from your trusty QtCreator install ? The process is quite simple actually, but Lucid users will need to do one extra step - add this special version of Qt to QtCreator (Maverick users already have Qt4.7 so they don't need this) by going to Tools->Options->Qt4, click add (plus sign) and fill out the form as below (note - when you create a new project, you will need to check fn-qt as the target !)

As now we have everything installed, let's create a new project that includes/uses, say, the MeeGo Touch Framework, all it takes is a line in the .pro file with

CONFIG += meegotouch

Now, we can make a Hello World app ! Just 15 lines later:

Before you jump into the deep water, however, be sure to check out the examples, they are a lot nicer than our little Hello World application !

sudo apt-get install qt-components-examples meegotouch-examples meegotouch-demos
How does this stuff look like on a desktop ? Lets try /opt/qt4/bin/widgetsgallery

... or if you want to take Qt Components for a spin, start /opt/qt4/bin/mthemedaemon in the background and then /opt/qt-components/calculator/calculator

Nice ! (if your Qt Components/QML examples look broken, doublecheck that /opt/qt4/bin/mthemedaemon is really running !)

Special thanks to Antonio Aloisio for providing the Qt Components packaging !

NOTE: As of the time of this article the Maverick packages are still building, so if you have issues with downloading the packages from the PPA, have a little patience !