QtCreator is an IDE from Nokia for Qt. It contains QtDesigner for UI design.

+

<!--T:2-->

+

QtCreator is an IDE from Nokia for Qt. It contains QtDesigner for UI design. This article describes:

+

* why to use Qt Creator

+

* how to create a new application

+

* how to load an existing application

−

= Creating a new program =

+

== Why use Qt Creator == <!--T:3-->

−

Qt Designer is a graphical program which allows you to easily build user interfaces, using a ''drag n drop'' interface. Here is a short example how it can go, for more information read the [http://qt.nokia.com/doc/designer-manual.html user documentation].

Select the mainwindow. This is the one un-intuitive step. To lay out the objects in the mainwindow, you do not select the objects in the mainwindow, but the mainwindow itself.

Select the mainwindow. This is the one un-intuitive step. To lay out the objects in the mainwindow, you do not select the objects in the mainwindow, but the mainwindow itself.

+

<!--T:11-->

[[File:Designer-step2.png|200px]]

[[File:Designer-step2.png|200px]]

+

<!--T:12-->

;Step 3:

;Step 3:

Select Form -> Lay Out in a <u>G</u>rid

Select Form -> Lay Out in a <u>G</u>rid

+

<!--T:13-->

[[File:Designer-step3.png|200px]]

[[File:Designer-step3.png|200px]]

+

<!--T:14-->

;Result:

;Result:

You get a decent look, and if you resize the window, the widgets resize as well.

You get a decent look, and if you resize the window, the widgets resize as well.

+

<!--T:15-->

[[File:Designer-result.png|200px]]

[[File:Designer-result.png|200px]]

−

== Using KDE libraries ==

+

=== Using KDE libraries === <!--T:16-->

−

To use KDE classes like KMessageBox, you need to tell qtcreator to use the KDE libraries when building. Go to your home directory, cd into ''yourproject'' and modify ''yourproject.pro''. Add a line

+

−

LIBS += -lkdeui

+

<!--T:17-->

+

To use KDE classes like KMessageBox, you need to tell QtCreator to use the KDE libraries when building. Go to your home directory, change into ''yourproject'' and modify ''yourproject.pro''. Add the line

+

<syntaxhighlight lang="make">

+

LIBS += -lkdeui

+

</syntaxhighlight>

Then you can start using KDE classes in your code.

Then you can start using KDE classes in your code.

−

== Adding a toolbar ==

+

=== Adding a toolbar === <!--T:18-->

−

To add a toolbar, right-click on the UI and choose "Add Toolbar". Then you can set icons and text in your mainwindow's constructor with code like this:

This describes how to use QtCreator to integrate existing KDE 4 applications. It has been tested with QtCreator 1.2.80 and SUSE Linux 11.1 but should work same or similar with every combination. As an example KDE application we use [http://userbase.kde.org/ktimetracker ktimetracker] from the kdepim module, other applications should work analog.

+

−

* Import the CMakeLists.txt file

+

<!--T:21-->

−

File -> Open -> kdepim/CMakeLists.txt.

+

This describes how to use QtCreator to integrate existing KDE 4 applications. It has been tested with QtCreator 1.2.80 and SUSE Linux 11.1 but should work same or similar with every combination. As an example KDE application we use [http://userbase.kde.org/ktimetracker ktimetracker] from the kdepim module, other applications should work likewise.

Load an existing project

This describes how to use QtCreator to integrate existing KDE 4 applications. It has been tested with QtCreator 1.2.80 and SUSE Linux 11.1 but should work same or similar with every combination. As an example KDE application we use ktimetracker from the kdepim module, other applications should work likewise.

You can either work with code on your disk or have QtCreator do the repository checkout.