1QToolBar(3qt)                                                    QToolBar(3qt)
2
3
4

NAME

6       QToolBar - Movable panel containing widgets such as tool buttons
7

SYNOPSIS

9       #include <qtoolbar.h>
10
11       Inherits QDockWindow.
12
13   Public Members
14       QToolBar ( const QString & label, QMainWindow *, ToolBarDock = DockTop,
15           bool newLine = FALSE, const char * name = 0 )  (obsolete)
16       QToolBar ( const QString & label, QMainWindow * mainWindow, QWidget *
17           parent, bool newLine = FALSE, const char * name = 0, WFlags f = 0 )
18       QToolBar ( QMainWindow * parent = 0, const char * name = 0 )
19       void addSeparator ()
20       QMainWindow * mainWindow () const
21       virtual void setStretchableWidget ( QWidget * w )
22       virtual void setLabel ( const QString & )
23       QString label () const
24       virtual void clear ()
25
26   Properties
27       QString label - the toolbar's label
28

DESCRIPTION

30       The QToolBar class provides a movable panel containing widgets such as
31       tool buttons.
32
33       A toolbar is a panel that contains a set of controls, usually
34       represented by small icons. It's purpose is to provide quick access to
35       frequently used commands or options. Within a QMainWindow the user can
36       drag toolbars within and between the dock areas. Toolbars can also be
37       dragged out of any dock area to float freely as top-level windows.
38
39       QToolBar is a specialization of QDockWindow, and so provides all the
40       functionality of a QDockWindow.
41
42       To use QToolBar you simply create a QToolBar as a child of a
43       QMainWindow, create a number of QToolButton widgets (or other widgets)
44       in left to right (or top to bottom) order and call addSeparator() when
45       you want a separator. When a toolbar is floated the caption used is the
46       label given in the constructor call. This can be changed with
47       setLabel().
48
49               QToolBar * fileTools = new QToolBar( this, "file operations" );
50               fileTools->setLabel( "File Operations" );
51               fileOpenAction->addTo( fileTools );
52               fileSaveAction->addTo( fileTools );
53
54       This extract from the application/application.cpp example shows the
55       creation of a new toolbar as a child of a QMainWindow and adding two
56       QActions.
57
58       You may use most widgets within a toolbar, with QToolButton and
59       QComboBox being the most common.
60
61       If you create a new widget on an already visible QToolBar, this widget
62       will automatically become visible without needing a show() call. (This
63       differs from every other Qt widget container. We recommend calling
64       show() anyway since we hope to fix this anomaly in a future release.)
65
66       QToolBars, like QDockWindows, are located in QDockAreas or float as
67       top-level windows. QMainWindow provides four QDockAreas (top, left,
68       right and bottom). When you create a new toolbar (as in the example
69       above) as a child of a QMainWindow the toolbar will be added to the top
70       dock area. You can move it to another dock area (or float it) by
71       calling QMainWindow::moveDockWindow(). QDock areas lay out their
72       windows in Lines.
73
74       If the main window is resized so that the area occupied by the toolbar
75       is too small to show all its widgets a little arrow button (which looks
76       like a right-pointing chevron, '&#187;') will appear at the right or
77       bottom of the toolbar depending on its orientation. Clicking this
78       button pops up a menu that shows the 'overflowing' items. QToolButtons
79       are represented in the menu using their textLabel property, other
80       QButton subclasses are represented using their text property, and
81       QComboBoxes are represented as submenus, with the caption text being
82       used in the submenu item.
83
84       Usually a toolbar will get precisely the space it needs. However, with
85       setHorizontalStretchable(), setVerticalStretchable() or
86       setStretchableWidget() you can tell the main window to expand the
87       toolbar to fill all available space in the specified orientation.
88
89       The toolbar arranges its buttons either horizontally or vertically (see
90       orientation() for details). Generally, QDockArea will set the
91       orientation correctly for you, but you can set it yourself with
92       setOrientation() and track any changes by connecting to the
93       orientationChanged() signal.
94
95       You can use the clear() method to remove all items from a toolbar.
96
97       <center>
98                                   [Image Omitted]
99
100       </center> <blockquote><p align="center"> A floating QToolbar (dock
101       window) </p> </blockquote>
102
103       See also QToolButton, QMainWindow, Parts of Isys on Visual Design, GUI
104       Design Handbook: Tool Bar, and Main Window and Related Classes.
105

MEMBER FUNCTION DOCUMENTATION

QToolBar::QToolBar ( const QString & label, QMainWindow *, ToolBarDock =

108       DockTop, bool newLine = FALSE, const char * name = 0 )
109       This function is obsolete. It is provided to keep old source working.
110       We strongly advise against using it in new code.
111

QToolBar::QToolBar ( const QString & label, QMainWindow * mainWindow, QWidget

113       * parent, bool newLine = FALSE, const char * name = 0, WFlags f = 0 )
114       Constructs an empty horizontal toolbar.
115
116       The toolbar is called name and is a child of parent and is managed by
117       mainWindow. The label and newLine parameters are passed straight to
118       QMainWindow::addDockWindow(). name and the widget flags f are passed on
119       to the QDockWindow constructor.
120
121       Use this constructor if you want to create torn-off (undocked,
122       floating) toolbars or toolbars in the status bar.
123

QToolBar::QToolBar ( QMainWindow * parent = 0, const char * name = 0 )

125       This is an overloaded member function, provided for convenience. It
126       behaves essentially like the above function.
127
128       Constructs an empty toolbar called name, with parent parent, in its
129       parent's top dock area, without any label and without requiring a
130       newline.
131

void QToolBar::addSeparator ()

133       Adds a separator to the right/bottom of the toolbar.
134
135       Examples:
136

void QToolBar::clear () [virtual]

138       Deletes all the toolbar's child widgets.
139

QString QToolBar::label () const

141       Returns the toolbar's label. See the "label" property for details.
142

QMainWindow * QToolBar::mainWindow () const

144       Returns a pointer to the QMainWindow which manages this toolbar.
145

void QToolBar::setLabel ( const QString & ) [virtual]

147       Sets the toolbar's label. See the "label" property for details.
148

void QToolBar::setStretchableWidget ( QWidget * w ) [virtual]

150       Sets the widget w to be expanded if this toolbar is requested to
151       stretch.
152
153       The request to stretch might occur because QMainWindow right-justifies
154       the dock area the toolbar is in, or because this toolbar's
155       isVerticalStretchable() or isHorizontalStretchable() is set to TRUE.
156
157       If you call this function and the toolbar is not yet stretchable,
158       setStretchable() is called.
159
160       See also QMainWindow::rightJustification, setVerticalStretchable(), and
161       setHorizontalStretchable().
162
163       Examples:
164
165   Property Documentation

QString label

167       This property holds the toolbar's label.
168
169       If the toolbar is floated the label becomes the toolbar window's
170       caption. There is no default label text.
171
172       Set this property's value with setLabel() and get this property's value
173       with label().
174
175

SEE ALSO

177       http://doc.trolltech.com/qtoolbar.html
178       http://www.trolltech.com/faq/tech.html
179
181       Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com.  See the
182       license file included in the distribution for a complete license
183       statement.
184

AUTHOR

186       Generated automatically from the source code.
187

BUGS

189       If you find a bug in Qt, please report it as described in
190       http://doc.trolltech.com/bughowto.html.  Good bug reports help us to
191       help you. Thank you.
192
193       The definitive Qt documentation is provided in HTML format; it is
194       located at $QTDIR/doc/html and can be read using Qt Assistant or with a
195       web browser. This man page is provided as a convenience for those users
196       who prefer man pages, although this format is not officially supported
197       by Trolltech.
198
199       If you find errors in this manual page, please report them to qt-
200       bugs@trolltech.com.  Please include the name of the manual page
201       (qtoolbar.3qt) and the Qt version (3.3.8).
202
203
204
205Trolltech AS                    2 February 2007                  QToolBar(3qt)
Impressum