Showing posts with label Qt Tutorials. Show all posts
Showing posts with label Qt Tutorials. Show all posts

Friday, June 4, 2010

Installing Qt SDK 4.6.2 on Ubuntu/Linux

Meego mobile development with Qt and C++ programming language
Qt is used for cross-platform desktop and mobile development for Symbian S60, Maemo (N900), Meego, Windows, Linux, and Mac OS X using C++ programming language.

To install the latest Qt SDK 4.6.2 on Ubuntu/Linux, follow these steps. For this example I'm using Ubuntu 10.04 Lucid Lynx.
  1. Download the Qt Development Environment 2010.02. Install the
  2. Install additional development libraries:

    sudo apt-get install libglib2.0-dev libSM-dev libxrender-dev libfontconfig1-dev libxext-dev libgl1-mesa-dev libglu-dev
You're now ready to develop cross-platform Qt applications.

Saturday, January 23, 2010

Installing Qt SDK 4.6.1 with Qt Creator 1.3.1 on Ubuntu

Now that Qt 4.6.1 SDK and Qt Creator 1.3.1 has been released by Nokia, I need to update my previous tutorial on setting up Qt Mobility development.
  1. Download Qt SDK Development Environment.
  2. Install Qt SDK. Launch Terminal, go to the folder where you downloaded Qt SDK distribution, and run:

    chmod +x qt-sdk-linux-x86-opensource-2010.01.bin
    ./qt-sdk-linux-x86-opensource-2010.01.bin
At the end of installation, you will be presented with this message:
Apart from a C++ compiler, a number of development libraries need to be present to enable Qt Creator to build your Qt applications. On Debian and Ubuntu, use the following command in a terminal to make sure they are installed:
sudo apt-get install libglib2.0-dev libSM-dev libxrender-dev libfontconfig1-dev libxext-dev
If you're using QtOpenGL, you'll also need OpenGL development files. You can use the following command to find out which packages to install:
sudo apt-get install libgl-dev libglu-dev
So just do what it tells you to:
sudo apt-get install libglib2.0-dev libSM-dev libxrender-dev libfontconfig1-dev libxext-dev
sudo apt-get install libgl-dev libglu-dev
Make sure you add Qt bin folder to your PATH environment. Edit $HOME/.profile and add:
export PATH=/opt/qtsdk-2010.01/qt/bin/:$PATH 
Now you can build and run Qt applications.
To build Qt Mobility apps, continue to Installing Qt Mobility libraries.

Thursday, December 31, 2009

Installing Qt 4.6 SDK in Windows 7

I'm planning to do some Qt for Symbian development. Qt Creator 1.3 has some support for Qt+Symbian development, but only on Windows. Although I love Ubuntu, currently I have to bow to the powers that be. No need to fight this (eventually I believe it'd be as easy to develop Qt Symbian apps on Linux).

Preparing Qt Development

  1. Download Qt Development Environment for Windows. (choose the complete bundle)
  2. Install the Qt IDE package.
    During this step I noticed that current Qt 4.6 bundle uses MinGW 3.15 aka GCC 4.4. I can foresee some problems with Qt Mobility. But I'll save my headaches for later.
Here's what Qt Creator 1.3 welcome page looks like: (nothing much, I know)


Simple Greeting Application


Of course installation of powerful IDE won't be complete without creating a trivial application:


Add some code:

void MainWindow::on_nameEdit_textChanged(QString name)
{
    ui->greetingLabel->setText("Hello " + name);
}

And here's the app in its full glory ;-)



Qt Command Line Environment


To enable compilation of Qt apps/libraries (such as Qt Mobility library) from the command line/shell, you must launch the command prompt from "Qt Command Prompt" launcher.



If you're already on a command prompt, you can setup Qt command line environment by running:
C:\Qt\2009.05\bin\qtenv
Use the Qt location installed on your system.

Tuesday, December 29, 2009

Hello World Qt GUI Application

It's time to create a Qt GUI Application, that displays Hello World.

If you want a less cool yet more bare-bones version, see the Hello World Qt Console app.

A little 'warning', this is too trivial.
  1. In Qt Creator, create a Qt project by clicking File -> New File or Project, or press Ctrl+N.

  2. Choose Qt4 Gui Application.

From Kev's Qt Mobility Development
  1. Introduction and project location. Pick a name and location for your new project.

From Kev's Qt Mobility Development
  1. Select required modules. Choose the Qt modules you want (QtCore and QtGui is always required).

From Kev's Qt Mobility Development
  1. Class Information. Edit the class information if necessary. Choose if you want the Qt4 UI Designer feature ( Generate form).

From Kev's Qt Mobility Development
  1. Project Management. Review the options, there is support for adding to version control if you're using it for the project.

From Kev's Qt Mobility Development
At this point, you'll have a new GUI project with sensible default widgets.

Running this starter project gives you:

From Kev's Qt Mobility Development
Not very functional, but quite impressive. You already got a dockable toolbar that you can drag around! ;-)

In Qt Creator, double-click mainwindow.ui to reveal Form Editor, which is an Qt Creator-integrated version of Qt Designer (a standalone app).

From Kev's Qt Mobility Development
Reminds me of Borland Delphi very much! Oh, the good old days...
To get a Hello World message:
  1. Drag a Label from the left widget box under Display Widgets.
  2. Set its text property to “Hello World”. You can also right click the Label, and click “ Change plain text...
  3. Set alignment.Horizontal to AlignHCenter.
  4. Click the main window, and click the Lay Out Vertically toolbar button (Ctrl+L). This applies the QVBoxLayout and expand the Label to fill the window.
This is how the form looks like in Qt's Form Editor:

From Kev's Qt Mobility Development
Preview your form by clicking Tools -> Form editor -> Preview (Ctrl+Alt+R).

From Kev's Qt Mobility Development
Actually my job to demonstrate Hello World is already finished, but... it's too easy, right?

Behind the scenes, Form Editor produces the following XML.

To see the UI code, close the current Form Editor. Then right-click mainwindow.ui, and click Open With -> Plain Text Editor.

<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
 <class>MainWindow</class>
 <widget class="QMainWindow" name="MainWindow">
  <property name="geometry">
   <rect>
    <x>0</x>
    <y>0</y>
    <width>309</width>
    <height>189</height>
   </rect>
  </property>
  <property name="windowTitle">
   <string>MainWindow</string>
  </property>
  <widget class="QWidget" name="centralWidget">
   <layout class="QGridLayout" name="gridLayout">
    <item row="0" column="0">
     <widget class="QLabel" name="label">
      <property name="text">
       <string>Hello World!</string>
      </property>
      <property name="alignment">
       <set>Qt::AlignCenter</set>
      </property>
     </widget>
    </item>
   </layout>
  </widget>
  <widget class="QMenuBar" name="menuBar">
   <property name="geometry">
    <rect>
     <x>0</x>
     <y>0</y>
     <width>309</width>
     <height>22</height>
    </rect>
   </property>
  </widget>
  <widget class="QToolBar" name="mainToolBar">
   <attribute name="toolBarArea">
    <enum>TopToolBarArea</enum>
   </attribute>
   <attribute name="toolBarBreak">
    <bool>true</bool>
   </attribute>
  </widget>
  <widget class="QStatusBar" name="statusBar"/>
 </widget>
 <layoutdefault spacing="6" margin="11"/>
 <resources/>
 <connections/>
</ui>

As you see, Form Editor / Qt Designer is very easy to use, and should be enough for most purposes. It also has its quirks, see a post about Fighting Qt Designer grid layout for more complex (and practical) examples.

Create a Hello World Console Application with Qt

A console application is usually used for daemon-style long-running background processes.

But just to get myself wet with Qt, here I create a Qt console application for displaying "Hello World".

Steps to Create The App

From Qt Creator, create a Qt Console application.

Right click the project, create a new class. Name the class HelloWorld and inherit from QObject.

Add sayHello() and done() methods so helloworld.h now looks like this:

helloworld.h :
#ifndef HELLOWORLD_H
#define HELLOWORLD_H

#include <QObject>

class HelloWorld : public QObject
{
Q_OBJECT
public:
    explicit HelloWorld(QObject *parent = 0);

signals:
    void done();

public slots:
    void sayHello();

};

#endif // HELLOWORLD_H

Implement the sayHello() method:

helloworld.cpp :
#include "helloworld.h"
#include <stdio.h>

HelloWorld::HelloWorld(QObject *parent) :
    QObject(parent)
{
}

void HelloWorld::sayHello() {
    printf("Hello World!\n");
    done();
}

In main.cpp, add some plumbing to use the HelloWorld class.

main.cpp :
#include <QObject>
#include <QtCore/QCoreApplication>
#include <QTimer>
#include <helloworld.h>
#include <stdio.h>

int main(int argc, char *argv[])
{
    fprintf(stderr, "Starting up...\n");

    QCoreApplication a(argc, argv);

    HelloWorld helloWorld;
    QObject::connect(&helloWorld, SIGNAL( done() ), &a, SLOT( quit() ), Qt::QueuedConnection);
    QTimer::singleShot(0, &helloWorld, SLOT( sayHello() ));

    return a.exec();
}

Running the App


To run the app, click the Run button or press Ctrl+R.

Qt Creator should build the application, and show the output in the Application Output panel.

Starting /home/ceefour/Sandbox/helloworld-console/helloworld-console...
Starting up...
Hello World!
/home/ceefour/Sandbox/helloworld-console/helloworld-console exited with code 0

Application Logic


The main entry point deserves some explanation.
  • It creates a Qt Core application (QCoreApplication) in variable a.
  • Connects helloWorld's done() signal to the app's quit() slot/method, with a connection type of Qt::QueuedConnection.
  • Creates a single shot timer (QTimer) with 0 ms delay that triggers helloWorld's sayHello() slot/method.
See Qt's Signals and Slots for more explanation what what connect, signals, and slots are. It's basically a unified event handling mechanism for Qt applications.

a.exec() will run Qt's event loop, which will process incoming events:
  1. The timer event will be processed, therefore executing helloWorld.sayHello().
  2. sayHello() does its job (printing "Hello World!"), then it will call its done() signal.
  3. helloWorld.done() signal was connected to a.quit(), therefore telling Qt application to stop the event loop and quit the application.
P.S.: Queued Connection

A default connection calls the slot directly. However, I use Qt::QueuedConnection here so that the call is queued until the slot processes the message.

In this case it's actually not needed.

It's possible to:
  • Run helloWorld.sayHello() directly (without using QTimer), and it can still exit the application because the event is queued.
  • Leave out the Qt::QueuedConnection, and it can still exit the application because the direct a.quit() call happens after the event loop is started.
What happens if helloWorld.sayHello() is run directly, and Qt::QueuedConnection is not specified?

The app will not quit immediately, because the event loop will not have started when a.quit() is called, therefore having no effect. Which is incorrect logic.

Why Separate Header (.h) and Implementation (.cpp) Files?


In this example I separated helloworld.h from helloworld.cpp. You may be wondering if it's  possible to merge them into just one helloworld.cpp implementation file.

The answer is No. At least not if you use Q_OBJECT or other Qt macros. Snippet from C++ GUI Programming with Qt 4:
For moc to work correctly, we must put the class definition in a header file, separate from the implementation file. The code generated by moc includes this header file and adds some C++ boilerplate code of its own.
So, don't fight it. Besides, that's the convention in C++ world anyway.

Reference: qt-interest thread: QCoreApplication won't quit

Monday, December 28, 2009

Setting Up Qt Creator 1.3 with Qt SDK 4.5

I try to develop with Qt Creator 1.3 on Qt 4.5 built-in on Ubuntu, since Qt 4.6 is still building on my Core 2 Duo laptop.

Install package libqt4-dev using Synaptic to get the Qt 4.5 development library.
$ sudo aptitude install libqt4-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
Reading extended state information
Initializing package states... Done
The following NEW packages will be installed:
comerr-dev{a} libaudio-dev{a} libgssrpc4{a} libkadm5srv6{a} libkdb5-4{a}
libkrb5-dev{a} libmng-dev{a} libpq-dev{a} libqt4-dev libqt4-opengl-dev{a}
libsqlite0-dev{a} libssl-dev{a} libxcursor-dev{a} libxfixes-dev{a}
libxft-dev{a} libxi-dev{a} libxinerama-dev{a} libxmu-dev{a}
libxmu-headers{a} libxrandr-dev{a} qt4-qmake{a} x11proto-fixes-dev{a}
x11proto-randr-dev{a} x11proto-xinerama-dev{a}
0 packages upgraded, 24 newly installed, 0 to remove and 0 not upgraded.
Need to get 7,797kB of archives. After unpacking 43.1MB will be used.
Do you want to continue? [Y/n/?] y
Writing extended state information... Done
Get:1 http://id.archive.ubuntu.com karmic/main x11proto-fixes-dev 1:4.0-3 [13.9kB]
Get:2 http://id.archive.ubuntu.com karmic/main libxfixes-dev 1:4.0.3-2build1 [12.9kB]
Get:3 http://id.archive.ubuntu.com karmic/main libxcursor-dev 1:1.1.9-1build1 [32.4kB]
Get:4 http://id.archive.ubuntu.com karmic/main libxft-dev 2.1.13-3ubuntu1 [64.1kB]
Get:5 http://id.archive.ubuntu.com karmic/main libxi-dev 2:1.2.1-2ubuntu1 [84.2kB]
Get:6 http://id.archive.ubuntu.com karmic/main x11proto-xinerama-dev 1.1.2-5ubuntu1 [5,772B]
Get:7 http://id.archive.ubuntu.com karmic/main libxinerama-dev 2:1.0.3-2 [11.7kB]
Get:8 http://id.archive.ubuntu.com karmic/main libxmu-headers 2:1.0.4-2 [21.5kB]
Get:9 http://id.archive.ubuntu.com karmic/main x11proto-randr-dev 1.3.0-1 [37.7kB]
Get:10 http://id.archive.ubuntu.com karmic/main libxrandr-dev 2:1.3.0-2 [34.5kB]
Get:11 http://id.archive.ubuntu.com karmic/main libgssrpc4 1.7dfsg~beta3-1 [76.4kB]
Get:12 http://id.archive.ubuntu.com karmic/main libkdb5-4 1.7dfsg~beta3-1 [58.1kB]
Get:13 http://id.archive.ubuntu.com karmic/main libkadm5srv6 1.7dfsg~beta3-1 [73.0kB]
Get:14 http://id.archive.ubuntu.com karmic/main libmng-dev 1.0.9-1build1 [295kB]
Get:15 http://id.archive.ubuntu.com karmic/main libssl-dev 0.9.8g-16ubuntu3 [2,022kB]
Get:16 http://id.archive.ubuntu.com karmic/main comerr-dev 2.1-1.41.9-1ubuntu3 [41.4kB]
Get:17 http://id.archive.ubuntu.com karmic/main libkrb5-dev 1.7dfsg~beta3-1 [101kB]
Get:18 http://id.archive.ubuntu.com karmic/main libpq-dev 8.4.1-1 [201kB]
Get:19 http://id.archive.ubuntu.com karmic/main qt4-qmake 4.5.3really4.5.2-0ubuntu1 [1,322kB]
Get:20 http://id.archive.ubuntu.com karmic/main libxmu-dev 2:1.0.4-2 [60.2kB]
Get:21 http://id.archive.ubuntu.com karmic/main libaudio-dev 1.9.2-1 [513kB]
Get:22 http://id.archive.ubuntu.com karmic/main libsqlite0-dev 2.8.17-6build1 [217kB]
Get:23 http://id.archive.ubuntu.com karmic/main libqt4-dev 4.5.3really4.5.2-0ubuntu1 [2,459kB]
Get:24 http://id.archive.ubuntu.com karmic/main libqt4-opengl-dev 4.5.3really4.5.2-0ubuntu1 [39.4kB]
Fetched 7,797kB in 4min 19s (30.0kB/s)
Selecting previously deselected package x11proto-fixes-dev.
(Reading database ... 235068 files and directories currently installed.)
Unpacking x11proto-fixes-dev (from .../x11proto-fixes-dev_1%3a4.0-3_all.deb) ...
Selecting previously deselected package libxfixes-dev.
Unpacking libxfixes-dev (from .../libxfixes-dev_1%3a4.0.3-2build1_i386.deb) ...
Selecting previously deselected package libxcursor-dev.
Unpacking libxcursor-dev (from .../libxcursor-dev_1%3a1.1.9-1build1_i386.deb) ...
Selecting previously deselected package libxft-dev.
Unpacking libxft-dev (from .../libxft-dev_2.1.13-3ubuntu1_i386.deb) ...
Selecting previously deselected package libxi-dev.
Unpacking libxi-dev (from .../libxi-dev_2%3a1.2.1-2ubuntu1_i386.deb) ...
Selecting previously deselected package x11proto-xinerama-dev.
Unpacking x11proto-xinerama-dev (from .../x11proto-xinerama-dev_1.1.2-5ubuntu1_all.deb) ...
Selecting previously deselected package libxinerama-dev.
Unpacking libxinerama-dev (from .../libxinerama-dev_2%3a1.0.3-2_i386.deb) ...
Selecting previously deselected package libxmu-headers.
Unpacking libxmu-headers (from .../libxmu-headers_2%3a1.0.4-2_all.deb) ...
Selecting previously deselected package x11proto-randr-dev.
Unpacking x11proto-randr-dev (from .../x11proto-randr-dev_1.3.0-1_all.deb) ...
Selecting previously deselected package libxrandr-dev.
Unpacking libxrandr-dev (from .../libxrandr-dev_2%3a1.3.0-2_i386.deb) ...
Selecting previously deselected package libgssrpc4.
Unpacking libgssrpc4 (from .../libgssrpc4_1.7dfsg~beta3-1_i386.deb) ...
Selecting previously deselected package libkdb5-4.
Unpacking libkdb5-4 (from .../libkdb5-4_1.7dfsg~beta3-1_i386.deb) ...
Selecting previously deselected package libkadm5srv6.
Unpacking libkadm5srv6 (from .../libkadm5srv6_1.7dfsg~beta3-1_i386.deb) ...
Selecting previously deselected package libmng-dev.
Unpacking libmng-dev (from .../libmng-dev_1.0.9-1build1_i386.deb) ...
Selecting previously deselected package libssl-dev.
Unpacking libssl-dev (from .../libssl-dev_0.9.8g-16ubuntu3_i386.deb) ...
Selecting previously deselected package comerr-dev.
Unpacking comerr-dev (from .../comerr-dev_2.1-1.41.9-1ubuntu3_i386.deb) ...
Selecting previously deselected package libkrb5-dev.
Unpacking libkrb5-dev (from .../libkrb5-dev_1.7dfsg~beta3-1_i386.deb) ...
Selecting previously deselected package libpq-dev.
Unpacking libpq-dev (from .../libpq-dev_8.4.1-1_i386.deb) ...
Selecting previously deselected package qt4-qmake.
Unpacking qt4-qmake (from .../qt4-qmake_4.5.3really4.5.2-0ubuntu1_i386.deb) ...
Selecting previously deselected package libxmu-dev.
Unpacking libxmu-dev (from .../libxmu-dev_2%3a1.0.4-2_i386.deb) ...
Selecting previously deselected package libaudio-dev.
Unpacking libaudio-dev (from .../libaudio-dev_1.9.2-1_i386.deb) ...
Selecting previously deselected package libsqlite0-dev.
Unpacking libsqlite0-dev (from .../libsqlite0-dev_2.8.17-6build1_i386.deb) ...
Selecting previously deselected package libqt4-dev.
Unpacking libqt4-dev (from .../libqt4-dev_4.5.3really4.5.2-0ubuntu1_i386.deb) ...
Selecting previously deselected package libqt4-opengl-dev.
Unpacking libqt4-opengl-dev (from .../libqt4-opengl-dev_4.5.3really4.5.2-0ubuntu1_i386.deb) ...
Processing triggers for man-db ...
Processing triggers for doc-base ...
Processing 1 added doc-base file(s)...
Registering documents with scrollkeeper...
Processing triggers for install-info ...
install-info: warning: no info dir entry in `/usr/share/info/menu.info.gz'
Setting up x11proto-fixes-dev (1:4.0-3) ...
Setting up libxfixes-dev (1:4.0.3-2build1) ...
Setting up libxcursor-dev (1:1.1.9-1build1) ...
Setting up libxft-dev (2.1.13-3ubuntu1) ...
Setting up libxi-dev (2:1.2.1-2ubuntu1) ...
Setting up x11proto-xinerama-dev (1.1.2-5ubuntu1) ...
Setting up libxinerama-dev (2:1.0.3-2) ...
Setting up libxmu-headers (2:1.0.4-2) ...
Setting up x11proto-randr-dev (1.3.0-1) ...
Setting up libxrandr-dev (2:1.3.0-2) ...
Setting up libgssrpc4 (1.7dfsg~beta3-1) ...
Setting up libkdb5-4 (1.7dfsg~beta3-1) ...
Setting up libkadm5srv6 (1.7dfsg~beta3-1) ...
Setting up libmng-dev (1.0.9-1build1) ...
Setting up libssl-dev (0.9.8g-16ubuntu3) ...
Setting up comerr-dev (2.1-1.41.9-1ubuntu3) ...
Setting up libkrb5-dev (1.7dfsg~beta3-1) ...
Setting up libpq-dev (8.4.1-1) ...
Setting up qt4-qmake (4.5.3really4.5.2-0ubuntu1) ...
update-alternatives: using /usr/bin/qmake-qt4 to provide /usr/bin/qmake (qmake) in auto mode.

Setting up libxmu-dev (2:1.0.4-2) ...
Setting up libaudio-dev (1.9.2-1) ...
Setting up libsqlite0-dev (2.8.17-6build1) ...
Setting up libqt4-dev (4.5.3really4.5.2-0ubuntu1) ...
update-alternatives: using /usr/bin/moc-qt4 to provide /usr/bin/moc (moc) in auto mode.
update-alternatives: using /usr/bin/uic-qt4 to provide /usr/bin/uic (uic) in auto mode.
update-alternatives: using /usr/bin/lupdate-qt4 to provide /usr/bin/lupdate (lupdate) in auto mode.
update-alternatives: using /usr/bin/lrelease-qt4 to provide /usr/bin/lrelease (lrelease) in auto mode.

Setting up libqt4-opengl-dev (4.5.3really4.5.2-0ubuntu1) ...
Processing triggers for libc-bin ...
ldconfig deferred processing now taking place
Reading package lists... Done
Building dependency tree
Reading state information... Done
Reading extended state information
Initializing package states... Done
Writing extended state information... Done
Launch Qt Creator. Now you can create a new project and launch it.

Qt Creator should detect your Qt4 installation properly.


From Kev's Qt Mobility Development

You certainly want to enable the Debugging Helper.
  1. Go to Tools -> Options -> Qt4 versions.
  2. Under Debugging Helper, click Debugging Helper -> Rebuild.
  3. The Debugging Helper icon will turn from red to green check mark.

Starting Up Qt Development

I created this blog to document my pursuit on Nokia's Qt Mobility Contest.

I use Ubuntu Karmic Koala 9.10, which contains Qt Creator 1.2 and Qt 4.5. I want to use the new Qt Creator 1.3 and Qt 4.6.

This is what Qt Creator 1.3 looks like for you curious people:


From Kev's Qt Mobility Development

Before jumping on to Qt Mobility and (then) Qt for Symbian, first I need to get started with Qt.
  1. Download Qt Development Environment (Qt Creator and Platform SDK)
  2. Install Qt Creator 1.3. This part was easy, simply chmod +x (add executable permission) to Qt Creator 1.3 installer and run it. It launches GUI Installer which was fast and smooth.
  3. Install Qt 4.6. Unfortunately, Nokia/TrollTech didn't provide Qt binaries for Linux systems.
  4. Configure Qt Creator with Qt 4.6. (and rebuild the debugging helper.) This one is easy, see below.

Installing Qt 4.6 from Sources
  1. Install checkinstall package. This will help you uninstall Qt 4.6 easily.
  2. Install dependencies:
    $ sudo apt-get build-dep libqt4-core
  3. Unpack the Qt 4.6 sources.
  4. Open a Terminal on the extracted folder.
  5. Run:
    $ ./configure
    By default, Qt will be installed at /usr/local/Trolltech. You may want to use the -prefix argument to specify another installation folder.
  6. Run:
    $ sudo checkinstall
    In case you can't/don't want to use checkinstall:
    $ sudo make install
  7. Be very patient.
    I've been running the make for about an hour now and it still hasn't finished. Time to take a nap.
    Update: Oh, it's finished in about 2.5 hours! Yaay!
Configure Qt Creator 1.3 with Qt 4.6


From Kev's Qt Mobility Development

  1. Launch Qt Creator.
  2. Go to Tools -> Options.
  3. Click "Qt versions".
  4. Click the Add button, then browse for your Qt 4.6 installation folder. Choose the bin/qmake binary.
    In my system, it is: /usr/local/Trolltech/Qt-4.6.0/bin/qmake
  5. Under Debugging Helper, click "Rebuild"
  6. Make sure you set it as Default Qt version
Now you should be able to create, run, and debug* Qt apps right away.

* GDB 7.0 Problems?

Qt says GDB 7.0 has issues with debugging. Unfortunately, Ubuntu 9.10 uses GDB 7.0:
$ gdb --version
GNU gdb (GDB) 7.0-ubuntu
Copyright (C) 2009 Free Software Foundation, Inc.
For Qt development, downgrading to GDB 6.8 is recommended for now.

And sure enough, I can't debug my simple Hello World Qt console application with GDB 7.0 installed:
&"warning: GDB: Failed to set controlling terminal: Invalid argument\n"
/home/ceefour/Sandbox/helloworld-console/helloworld-console: symbol lookup error:
/usr/local/Trolltech/Qt-4.6.0/lib/libQtGui.so.4: undefined symbol: _ZNK17QVariantAnimation10metaObjectEv