views:

83

answers:

2

Hi,

I'm beginner to Qt and I see that most of widgets that are build in in Qt do not appear in the widgets tool box.

  1. How can I add all the widget to tool box? (Like QSystemTrayIcon that does not appear by default in tool box)

  2. what is the best way to write gui - by the designer - ui file or by code - cpp file?

Thanks!

+1  A: 

The designer just shows widgets which are displayed in a window. It doesn't make sense to 'design' a QSystemTrayIcon in a window design tool. Just create it from code during startup.

Wether you write the UI code by hand or use the designer is really up to you. Speaking of me, I consider Qt's designer a very mature tool that helps designing my user interfaces quickly. So yes, I use it...

milan1612
and what about the build in dialogs which do not appear in the tol box? ow can I add them?
dubila
no, you can't design them, you have to do it by code. look here for an example: http://doc.qt.nokia.com/4.7/qfiledialog.html#details
milan1612
and QIcon? - which I want to drag to my form?
dubila
nope, you can't do that with QIcon. what you probably want is QLabel. you can assign a pixmap to it to display an image on your window...
milan1612
A: 

I would advice to not use designer, in order to work with a pure c++ code and do not deal with some qt code generations. It is flexible approach in my opinion, though, I guess, lot of people use Qt designer, and even like it. So this is something personal. But, honestly, I used Qt designer when I was a beginner. Configuring widgets with a visual editor was a great help for me. No I prefer only coding.

WRT adding the widgets you listed - no it is not possible. You should instantiate them manually.

Narek