File: qtoolbar.3qt

package info (click to toggle)
qt-copy 2%3A3.0.3-20020329-1woody2
  • links: PTS
  • area: main
  • in suites: woody
  • size: 77,328 kB
  • ctags: 59,132
  • sloc: cpp: 413,292; ansic: 88,042; sh: 10,673; yacc: 2,874; xml: 2,310; makefile: 466; lex: 453; perl: 422; sql: 29; lisp: 15
file content (165 lines) | stat: -rw-r--r-- 8,518 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
'\" t
.TH QToolBar 3qt "18 March 2002" "Trolltech AS" \" -*- nroff -*-
.\" Copyright 1992-2001 Trolltech AS.  All rights reserved.  See the
.\" license file included in the distribution for a complete license
.\" statement.
.\"
.ad l
.nh
.SH NAME
QToolBar \- Movable panel containing widgets such as tool buttons
.SH SYNOPSIS
\fC#include <qtoolbar.h>\fR
.PP
Inherits QDockWindow.
.PP
.SS "Public Members"
.in +1c
.ti -1c
.BI "QToolBar ( const QString & label, QMainWindow *, ToolBarDock = DockTop, bool newLine = FALSE, const char * name = 0 )  \fI(obsolete)\fR"
.br
.ti -1c
.BI "\fBQToolBar\fR ( const QString & label, QMainWindow * mainWindow, QWidget * parent, bool newLine = FALSE, const char * name = 0, WFlags f = 0 )"
.br
.ti -1c
.BI "\fBQToolBar\fR ( QMainWindow * parent = 0, const char * name = 0 )"
.br
.ti -1c
.BI "void \fBaddSeparator\fR ()"
.br
.ti -1c
.BI "QMainWindow * \fBmainWindow\fR () const"
.br
.ti -1c
.BI "virtual void \fBsetStretchableWidget\fR ( QWidget * w )"
.br
.ti -1c
.BI "virtual void \fBsetLabel\fR ( const QString & )"
.br
.ti -1c
.BI "QString \fBlabel\fR () const"
.br
.ti -1c
.BI "virtual void \fBclear\fR ()"
.br
.in -1c
.SS "Properties"
.in +1c
.ti -1c
.BI "QString \fBlabel\fR - the label of the toolbar"
.br
.in -1c
.SH DESCRIPTION
The QToolBar class provides a movable panel containing widgets such as tool buttons.
.PP
A toolbar is a panel that contains a set of controls, usually represented by small icons. It's purpose is to provide quick access to frequently used commands or options. Within a QMainWindow the user can drag toolbars within and between the dock areas. Toolbars can also be dragged out of any dock area to float freely as top level windows.
.PP
QToolBar is a specialization of QDockWindow, and so provides all the functionality of a QDockWindow.
.PP
To use QToolBar you simply create a QToolBar as a child of a QMainWindow, create a number of QToolButton widgets (or other widgets) in left to right (or top to bottom) order and call addSeparator() when you want a separator. When a toolbar is floated the caption used is the label given in the constructor call. This can be changed with setLabel().
.PP
.nf
.br
        QToolBar * fileTools = new QToolBar( this, "file operations" );
.br
        fileTools->setLabel( "File Operations" );
.br
        fileOpenAction->addTo( fileTools );
.br
        fileSaveAction->addTo( fileTools );
.fi
.PP
This extract from the application/application.cpp example shows the creation of a new toolbar as a child of a QMainWindow and adding two QActions.
.PP
You may use most widgets within a toolbar, with QToolButton and QComboBox being the most common.
.PP
Note that if you create a new widget on a already visible QToolBar, this widget becomes automatically visible without explicitly calling show() on it (unlike in all other widget containers in Qt). Please call explicitly show() on all widgets you put into an already visible QToolBar anyway, as this behavior might be fixed in the future.
.PP
QToolBars, like QDockWindows, are located in QDockAreas or float as top level windows. QMainWindow provides four QDockAreas (top, left, right and bottom). When you create a new toolbar (as in the example above) as a child of a QMainWindow the toolbar will be added to the top dock area. You can move it to another dock area (or float it) by calling QMainWindow::moveDockWindow(). QDock areas lay out their windows in Lines.
.PP
If the main window is resized so that the area occupied by the toolbar is too small to show all its widgets a little arrow button (which looks like a right-pointing chevron, '&#187;') will appear at the right or bottom of the toolbar depending on its orientation. Clicking this button pops up a menu that shows the 'overflowing' items.
.PP
Usually a toolbar will get precisely the space it needs. However, with setHorizontalStretchable(), setVerticalStretchable() or setStretchableWidget() you can tell the main window to expand the toolbar to fill all available space in the specified orientation.
.PP
The toolbar arranges its buttons either horizontally or vertically (see orientation() for details). Generally, QDockArea will set the orientation correctly for you, but you can set it yourself with setOrientation() and track any changes by connecting to the orientationChanged() signal.
.PP
You can use the clear() method to remove all items from a toolbar.
.PP
<center>
.ce 1
.B "[Image Omitted]"
.PP
</center> <blockquote><p align="center">\fI A floating QToolbar (dock window) \fR</p> </blockquote>
.PP
See also QToolButton, QMainWindow, Parts of Isys on Visual Design, GUI Design Handbook: Tool Bar and Main Window and Related Classes.
.SH MEMBER FUNCTION DOCUMENTATION
.SH "QToolBar::QToolBar ( const QString & label, QMainWindow *, ToolBarDock = DockTop, bool newLine = FALSE, const char * name = 0 )"
\fBThis function is obsolete.\fR It is provided to keep old source working. We strongly advise against using it in new code.
.SH "QToolBar::QToolBar ( const QString & label, QMainWindow * mainWindow, QWidget * parent, bool newLine = FALSE, const char * name = 0, WFlags f = 0 )"
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
.PP
Constructs an empty horizontal toolbar.
.PP
The toolbar is a child of \fIparent\fR and is managed by \fImainWindow\fR. The \fIlabel\fR and \fInewLine\fR parameters are passed straight to QMainWindow::addDockWindow(). \fIname\fR is the object name and \fIf\fR is the widget flags.
.PP
Use this constructor if you want to create torn-off (undocked, floating) toolbars or toolbars in the status bar.
.SH "QToolBar::QToolBar ( QMainWindow * parent = 0, const char * name = 0 )"
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
.PP
Constructs an empty toolbar, with parent \fIparent\fR and name \fIname\fR, in its \fIparent\fR's top dock area, without any label and without requiring a newline.
.SH "void QToolBar::addSeparator ()"
Adds a separator to the right/bottom of the toolbar.
.PP
Examples:
.)l fileiconview/mainwindow.cpp, helpviewer/helpwindow.cpp, qfd/fontdisplayer.cpp and scribble/scribble.cpp.
.SH "void QToolBar::clear ()\fC [virtual]\fR"
Deletes all the toolbar's child widgets.
.SH "QString QToolBar::label () const"
Returns the label of the toolbar. See the "label" property for details.
.SH "QMainWindow * QToolBar::mainWindow () const"
Returns a pointer to the QMainWindow which manages this toolbar.
.SH "void QToolBar::setLabel ( const QString & )\fC [virtual]\fR"
Sets the label of the toolbar. See the "label" property for details.
.SH "void QToolBar::setStretchableWidget ( QWidget * w )\fC [virtual]\fR"
Sets the widget \fIw\fR to be expanded if this toolbar is requested to stretch.
.PP
The request to stretch might occur because QMainWindow right-justifies the dock it's in, or because this toolbar's isVerticalStretchable() or isHorizontalStretchable() is set to TRUE.
.PP
If you call this function and the toolbar is not yet stretchable, setStretchable() is called.
.PP
See also QMainWindow::rightJustification, setVerticalStretchable() and setHorizontalStretchable().
.PP
Examples:
.)l fileiconview/mainwindow.cpp and helpviewer/helpwindow.cpp.
.SS "Property Documentation"
.SH "QString label"
This property holds the label of the toolbar.
.PP
If the toolbar is floated the label becomes the toolbar window's caption. There is no default label text.
.PP
Set this property's value with setLabel() and get this property's value with label().

.SH "SEE ALSO"
.BR http://doc.trolltech.com/qtoolbar.html
.BR http://www.trolltech.com/faq/tech.html
.SH COPYRIGHT
Copyright 1992-2001 Trolltech AS, http://www.trolltech.com.  See the
license file included in the distribution for a complete license
statement.
.SH AUTHOR
Generated automatically from the source code.
.SH BUGS
If you find a bug in Qt, please report it as described in
.BR http://doc.trolltech.com/bughowto.html .
Good bug reports help us to help you. Thank you.
.P
The definitive Qt documentation is provided in HTML format; it is
located at $QTDIR/doc/html and can be read using Qt Assistant or with
a web browser. This man page is provided as a convenience for those
users who prefer man pages, although this format is not officially
supported by Trolltech. 
.P
If you find errors in this manual page, please report them to
.BR qt-bugs@trolltech.com .
Please include the name of the manual page (qtoolbar.3qt) and the Qt
version (3.0.3).