PDA

View Full Version : QToolBar in a new UI form?



gfunk
22nd May 2006, 22:59
I wanted to add a QToolBar to a new UI Dialog form. But, I can't find the QToolBar icon in the Qt Toolbox. Is there a way I can do this in QtDesigner? I know that in QMainWindow's you can right-click to insert a toolbar, maybe toolbars are only meant for QMainWindow?

wysota
23rd May 2006, 00:05
(...)maybe toolbars are only meant for QMainWindow?

Yes, they are meant only for QMainWindows.

mcosta
23rd May 2006, 11:50
I wanted to add a QToolBar to a new UI Dialog form. But, I can't find the QToolBar icon in the Qt Toolbox. Is there a way I can do this in QtDesigner? I know that in QMainWindow's you can right-click to insert a toolbar, maybe toolbars are only meant for QMainWindow?

The only way to add a MenuBar, ToolBar, StatusBar to a Form is to use QMainWindow as Base class.

manhds
1st June 2006, 06:33
Yes, they are meant only for QMainWindows.
No !
any Widget or Dialog. We can add Toolbar:

- define 1 tool bar:("this" is widget(Dialog) want add toolbar)
QToolBar * m_pobTB;


m_pobTB=new QToolBar(this);

and on Toolbar add Action need

- set position of Toolbar
m_pobTB->setGeometry(0,0,width(),30); // example

manhds
1st June 2006, 06:35
Can you help me !
http://www.qtforum.org/thread.php?threadid=17221

zlatko
1st June 2006, 08:51
Ask about your problem here...most of this forums users ignore old qt forum...

wysota
1st June 2006, 16:48
No !
any Widget or Dialog.
Not from Designer.

We can add Toolbar:

- define 1 tool bar:("this" is widget(Dialog) want add toolbar)
QToolBar * m_pobTB;


m_pobTB=new QToolBar(this);

and on Toolbar add Action need

- set position of Toolbar
m_pobTB->setGeometry(0,0,width(),30); // example
Of course we can, as the toolbar itself is a widget like any else. But some functionality related to toolbars can only be provided by QMainWindow. In other cases, you'd have to implement it yourself.

manhds
2nd June 2006, 12:19
Ask about your problem here...most of this forums users ignore old qt forum...
no thanks !
I find my problem