Difference between revisions of "Development/Tutorials/Using Qt Creator"

Jump to: navigation, search
(Adding a toolbar)
Line 34: Line 34:
 
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:
 
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:
 
  ui->toolBar->addAction(QIcon("/usr/share/icons/oxygen/22x22/apps/ktip.png"),"hello world");
 
  ui->toolBar->addAction(QIcon("/usr/share/icons/oxygen/22x22/apps/ktip.png"),"hello world");
 +
 +
[[Development/Tutorials/Using_Qt_Designer|More Info...]]
  
 
= See also =
 
= See also =
 
* [[Development/Tutorials/Using Qt Designer]]
 
* [[Development/Tutorials/Using Qt Designer]]
 
* [[Getting_Started/Set_up_KDE_4_for_development#QtCreator]]
 
* [[Getting_Started/Set_up_KDE_4_for_development#QtCreator]]

Revision as of 08:34, 28 February 2010


Contents

Development/Tutorials/Using Qt Creator


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

Creating a new program

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 user documentation.

Step 0

Call Qt Designer from within the QtCreator IDE:

qtcreator
Step 1

Add the widgets you want by drag-and-drop

Designer-step1.png

Step 2

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.

Designer-step2.png

Step 3

Select Form -> Lay Out in a Grid

Designer-step3.png

Result

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

Designer-result.png

Adding a toolbar

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:

ui->toolBar->addAction(QIcon("/usr/share/icons/oxygen/22x22/apps/ktip.png"),"hello world");

More Info...

See also


KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V.Legal