Using Qt3D today

Qt3D is an amazing library for Qt that gives you the ability to render your own 3D stuff together with your existing widget or QML based GUI. The library was started by the Qt developers a few years back, but has not yet been released with the official Qt SDK. It was announced that it would be bundled with Qt5.0, but because of the state of the library at the time, its release was postponed. Even so, the library is still very mature and appears to work very well in my opinion. So I would urge you to test it out.

Simple install on Ubuntu

To use the library you have a couple of different choices. If you are running Ubuntu, you may just run the following commands:

sudo apt-get install qt3d5-dev qtdeclarative5-qt3d-plugin

And you should be good to go. Look for examples in the Qt3D documentation.

Note that Ubuntu currently doesn’t have QtQuick.Controls available, so you will have to follow the instructions below to combine Qt3D with QtQuick.Controls.

Install Qt3D into the newest Qt release

Currently Qt5.1.1 is the newest stable release of Qt and is the version I’d recommend that you use with Qt3D.

  1. Download and installĀ Qt5.1.1.
  2. Clone Qt3D from Gitorious:
    git clone git:// qt3d
  3. Open QtCreator from your new Qt installation.
  4. Open the file from the cloned repository and configure it to use the platforms on which you want to use Qt3D (desktop, Android, etc.).
  5. Build for each platform you want to use. Set the build to Release instead of Debug mode while building. You should receive about one hundred warnings if you are building for Android. As always, ignore these.
  6. Open the build folder in a terminal and run
    make install

    This will not install to your system, but to your Qt installation, so that it gets the ability to do awesome 3D stuff.

You should now have Qt3D installed in your Qt installation and be ready to run projects that are using Qt3D.

Handling locked screen event in Qt for Maemo

If you want to pause an application to save battery power when the screen is turned off, you can do this by listening for the locked screen event in Qt for Maemo. However, this is not made easily available through a wrapper function (that I know of), so in this case we’ll need to resort to listening for the right DBus call. (Thanks to Diph from for providing the recipe to make this possible.)

First of all, you’ll need to enable dbus in your project (.pro) file:

maemo5 {
    CONFIG += qdbus

Next up, in your .h file you should add the following to import the DBus headers:

#ifdef Q_WS_MAEMO_5
#include <QtDBus/QtDBus>

And you’ll need to add a slot for the screen state change:

Continue reading Handling locked screen event in Qt for Maemo

Handling application minimization in Maemo with Qt

When you are developing with Qt on Maemo you might want to minimize or detect minimization of your application to the dashboard. Qt lacks clean functions for these use cases, but thankfully it’s still very easy to accomplish them.

Minimizing the application

First of all, to minimize your application you’ll need to add the following CONFIG line to your project file (the .pro file):

maemo5 {
    CONFIG += qdbus

Then, in your .cpp or .h file, you’ll need to include the QtDBus headers:

#ifdef Q_WS_MAEMO_5
#include <QtDBus/QtDBus>

You may of course skip the #ifdef statements if you’d like DBus for other systems as well, but here I’d like to make this exception only for Maemo. Now, anywhere in your application you may add the following lines to minimize to Maemo’s dashboard:

Continue reading Handling application minimization in Maemo with Qt