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
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
|
'\" t
.TH TQBoxLayout 3qt "2 February 2007" "Trolltech AS" \" -*- nroff -*-
.\" Copyright 1992-2007 Trolltech ASA. All rights reserved. See the
.\" license file included in the distribution for a complete license
.\" statement.
.\"
.ad l
.nh
.SH NAME
TQBoxLayout \- Lines up child widgets horizontally or vertically
.SH SYNOPSIS
\fC#include <tqlayout.h>\fR
.PP
Inherits TQLayout.
.PP
Inherited by TQHBoxLayout and TQVBoxLayout.
.PP
.SS "Public Members"
.in +1c
.ti -1c
.BI "enum \fBDirection\fR { LeftToRight, RightToLeft, TopToBottom, BottomToTop, Down = TopToBottom, Up = BottomToTop }"
.br
.ti -1c
.BI "\fBTQBoxLayout\fR ( TQWidget * parent, Direction d, int margin = 0, int spacing = -1, const char * name = 0 )"
.br
.ti -1c
.BI "\fBTQBoxLayout\fR ( TQLayout * parentLayout, Direction d, int spacing = -1, const char * name = 0 )"
.br
.ti -1c
.BI "\fBTQBoxLayout\fR ( Direction d, int spacing = -1, const char * name = 0 )"
.br
.ti -1c
.BI "\fB~TQBoxLayout\fR ()"
.br
.ti -1c
.BI "virtual void \fBaddItem\fR ( TQLayoutItem * item )"
.br
.ti -1c
.BI "Direction \fBdirection\fR () const"
.br
.ti -1c
.BI "void \fBsetDirection\fR ( Direction direction )"
.br
.ti -1c
.BI "void \fBaddSpacing\fR ( int size )"
.br
.ti -1c
.BI "void \fBaddStretch\fR ( int stretch = 0 )"
.br
.ti -1c
.BI "void \fBaddWidget\fR ( TQWidget * widget, int stretch = 0, int alignment = 0 )"
.br
.ti -1c
.BI "void \fBaddLayout\fR ( TQLayout * layout, int stretch = 0 )"
.br
.ti -1c
.BI "void \fBaddStrut\fR ( int size )"
.br
.ti -1c
.BI "void \fBinsertSpacing\fR ( int index, int size )"
.br
.ti -1c
.BI "void \fBinsertStretch\fR ( int index, int stretch = 0 )"
.br
.ti -1c
.BI "void \fBinsertWidget\fR ( int index, TQWidget * widget, int stretch = 0, int alignment = 0 )"
.br
.ti -1c
.BI "void \fBinsertLayout\fR ( int index, TQLayout * layout, int stretch = 0 )"
.br
.ti -1c
.BI "bool \fBsetStretchFactor\fR ( TQWidget * w, int stretch )"
.br
.ti -1c
.BI "bool \fBsetStretchFactor\fR ( TQLayout * l, int stretch )"
.br
.ti -1c
.BI "virtual TQSize \fBsizeHint\fR () const"
.br
.ti -1c
.BI "virtual TQSize \fBminimumSize\fR () const"
.br
.ti -1c
.BI "virtual TQSize \fBmaximumSize\fR () const"
.br
.ti -1c
.BI "virtual bool \fBhasHeightForWidth\fR () const"
.br
.ti -1c
.BI "virtual int \fBheightForWidth\fR ( int w ) const"
.br
.ti -1c
.BI "virtual TQSizePolicy::ExpandData \fBexpanding\fR () const"
.br
.ti -1c
.BI "virtual void \fBinvalidate\fR ()"
.br
.ti -1c
.BI "virtual void \fBsetGeometry\fR ( const TQRect & r )"
.br
.ti -1c
.BI "int \fBfindWidget\fR ( TQWidget * w )"
.br
.in -1c
.SS "Protected Members"
.in +1c
.ti -1c
.BI "void \fBinsertItem\fR ( int index, TQLayoutItem * item )"
.br
.in -1c
.SH DESCRIPTION
The TQBoxLayout class lines up child widgets horizontally or vertically.
.PP
TQBoxLayout takes the space it gets (from its parent layout or from the mainWidget()), divides it up into a row of boxes, and makes each managed widget fill one box.
.PP
<center>
.ce 1
.B "[Image Omitted]"
.PP
</center>
.PP
If the TQBoxLayout's orientation is Horizontal the boxes are placed in a row, with suitable sizes. Each widget (or other box) will get at least its minimum size and at most its maximum size. Any excess space is shared according to the stretch factors (more about that below).
.PP
<center>
.ce 1
.B "[Image Omitted]"
.PP
</center>
.PP
If the TQBoxLayout's orientation is Vertical, the boxes are placed in a column, again with suitable sizes.
.PP
The easiest way to create a TQBoxLayout is to use one of the convenience classes, e.g. TQHBoxLayout (for Horizontal boxes) or TQVBoxLayout (for Vertical boxes). You can also use the TQBoxLayout constructor directly, specifying its direction as LeftToRight, Down, RightToLeft or Up.
.PP
If the TQBoxLayout is not the top-level layout (i.e. it is not managing all of the widget's area and children), you must add it to its parent layout before you can do anything with it. The normal way to add a layout is by calling parentLayout->addLayout().
.PP
Once you have done this, you can add boxes to the TQBoxLayout using one of four functions:
.TP
addWidget() to add a widget to the TQBoxLayout and set the widget's stretch factor. (The stretch factor is along the row of boxes.)
.IP
.TP
addSpacing() to create an empty box; this is one of the functions you use to create nice and spacious dialogs. See below for ways to set margins.
.IP
.TP
addStretch() to create an empty, stretchable box.
.IP
.TP
addLayout() to add a box containing another TQLayout to the row and set that layout's stretch factor.
.PP
Use insertWidget(), insertSpacing(), insertStretch() or insertLayout() to insert a box at a specified position in the layout.
.PP
TQBoxLayout also includes two margin widths:
.TP
setMargin() sets the width of the outer border. This is the width of the reserved space along each of the TQBoxLayout's four sides.
.TP
setSpacing() sets the width between neighboring boxes. (You can use addSpacing() to get more space at a particular spot.)
.PP
The margin defaults to 0. The spacing defaults to the same as the margin width for a top-level layout, or to the same as the parent layout. Both are parameters to the constructor.
.PP
To remove a widget from a layout, call remove(). Calling TQWidget::hide() on a widget also effectively removes the widget from the layout until TQWidget::show() is called.
.PP
You will almost always want to use TQVBoxLayout and TQHBoxLayout rather than TQBoxLayout because of their convenient constructors.
.PP
See also TQGrid, Layout Overview, Widget Appearance and Style, and Layout Management.
.SS "Member Type Documentation"
.SH "TQBoxLayout::Direction"
This type is used to determine the direction of a box layout.
.TP
\fCTQBoxLayout::LeftToRight\fR - Horizontal, from left to right
.TP
\fCTQBoxLayout::RightToLeft\fR - Horizontal, from right to left
.TP
\fCTQBoxLayout::TopToBottom\fR - Vertical, from top to bottom
.TP
\fCTQBoxLayout::Down\fR - The same as TopToBottom
.TP
\fCTQBoxLayout::BottomToTop\fR - Vertical, from bottom to top
.TP
\fCTQBoxLayout::Up\fR - The same as BottomToTop
.SH MEMBER FUNCTION DOCUMENTATION
.SH "TQBoxLayout::TQBoxLayout ( TQWidget * parent, Direction d, int margin = 0, int spacing = -1, const char * name = 0 )"
Constructs a new TQBoxLayout with direction \fId\fR and main widget \fIparent\fR. \fIparent\fR may not be 0.
.PP
The \fImargin\fR is the number of pixels between the edge of the widget and its managed children. The \fIspacing\fR is the default number of pixels between neighboring children. If \fIspacing\fR is -1 the value of \fImargin\fR is used for \fIspacing\fR.
.PP
\fIname\fR is the internal object name.
.PP
See also direction().
.SH "TQBoxLayout::TQBoxLayout ( TQLayout * parentLayout, Direction d, int spacing = -1, const char * name = 0 )"
Constructs a new TQBoxLayout called \fIname\fR, with direction \fId\fR, and inserts it into \fIparentLayout\fR.
.PP
The \fIspacing\fR is the default number of pixels between neighboring children. If \fIspacing\fR is -1, the layout will inherit its parent's spacing().
.SH "TQBoxLayout::TQBoxLayout ( Direction d, int spacing = -1, const char * name = 0 )"
Constructs a new TQBoxLayout called \fIname\fR, with direction \fId\fR.
.PP
If \fIspacing\fR is -1, the layout will inherit its parent's spacing(); otherwise \fIspacing\fR is used.
.PP
You must insert this box into another layout.
.SH "TQBoxLayout::~TQBoxLayout ()"
Destroys this box layout.
.PP
The layout's widgets aren't destroyed.
.SH "void TQBoxLayout::addItem ( TQLayoutItem * item )\fC [virtual]\fR"
Adds \fIitem\fR to the end of this box layout.
.PP
Examples:
.)l chart/optionsform.cpp and chart/setdataform.cpp.
.PP
Reimplemented from TQLayout.
.SH "void TQBoxLayout::addLayout ( TQLayout * layout, int stretch = 0 )"
Adds \fIlayout\fR to the end of the box, with serial stretch factor \fIstretch\fR.
.PP
When a layout is constructed with another layout as its parent, you don't need to call addLayout(); the child layout is automatically added to the parent layout as it is constructed.
.PP
See also insertLayout(), setAutoAdd(), addWidget(), and addSpacing().
.PP
Examples:
.)l chart/optionsform.cpp, chart/setdataform.cpp, fonts/simple-tqfont-demo/viewer.cpp, listbox/listbox.cpp, regexptester/regexptester.cpp, and tictac/tictac.cpp.
.SH "void TQBoxLayout::addSpacing ( int size )"
Adds a non-stretchable space with size \fIsize\fR to the end of this box layout. TQBoxLayout provides default margin and spacing. This function adds additional space.
.PP
See also insertSpacing() and addStretch().
.PP
Example: listbox/listbox.cpp.
.SH "void TQBoxLayout::addStretch ( int stretch = 0 )"
Adds a stretchable space with zero minimum size and stretch factor \fIstretch\fR to the end of this box layout.
.PP
See also addSpacing().
.PP
Examples:
.)l layout/layout.cpp, listbox/listbox.cpp, regexptester/regexptester.cpp, and t13/gamebrd.cpp.
.SH "void TQBoxLayout::addStrut ( int size )"
Limits the perpendicular dimension of the box (e.g. height if the box is LeftToRight) to a minimum of \fIsize\fR. Other constraints may increase the limit.
.SH "void TQBoxLayout::addWidget ( TQWidget * widget, int stretch = 0, int alignment = 0 )"
Adds \fIwidget\fR to the end of this box layout, with a stretch factor of \fIstretch\fR and alignment \fIalignment\fR.
.PP
The stretch factor applies only in the direction of the TQBoxLayout, and is relative to the other boxes and widgets in this TQBoxLayout. Widgets and boxes with higher stretch factors grow more.
.PP
If the stretch factor is 0 and nothing else in the TQBoxLayout has a stretch factor greater than zero, the space is distributed according to the TQWidget:sizePolicy() of each widget that's involved.
.PP
Alignment is specified by \fIalignment\fR which is a bitwise OR of TQt::AlignmentFlags values. The default alignment is 0, which means that the widget fills the entire cell.
.PP
From TQt 3.0, the \fIalignment\fR parameter is interpreted more aggressively than in previous versions of Qt. A non-default alignment now indicates that the widget should not grow to fill the available space, but should be sized according to sizeHint().
.PP
See also insertWidget(), setAutoAdd(), addLayout(), and addSpacing().
.PP
Examples:
.)l chart/optionsform.cpp, checklists/checklists.cpp, layout/layout.cpp, lineedits/lineedits.cpp, listbox/listbox.cpp, t13/gamebrd.cpp, and t13/lcdrange.cpp.
.SH "Direction TQBoxLayout::direction () const"
Returns the direction of the box. addWidget() and addSpacing() work in this direction; the stretch stretches in this direction.
.PP
See also TQBoxLayout::Direction, addWidget(), and addSpacing().
.SH "TQSizePolicy::ExpandData TQBoxLayout::expanding () const\fC [virtual]\fR"
Returns whether this layout can make use of more space than sizeHint(). A value of Vertical or Horizontal means that it wants to grow in only one dimension, whereas \fCBothDirections\fR means that it wants to grow in both dimensions.
.PP
Reimplemented from TQLayout.
.SH "int TQBoxLayout::findWidget ( TQWidget * w )"
Searches for widget \fIw\fR in this layout (not including child layouts).
.PP
Returns the index of \fIw\fR, or -1 if \fIw\fR is not found.
.SH "bool TQBoxLayout::hasHeightForWidth () const\fC [virtual]\fR"
Returns TRUE if this layout's preferred height depends on its width; otherwise returns FALSE.
.PP
Reimplemented from TQLayoutItem.
.SH "int TQBoxLayout::heightForWidth ( int w ) const\fC [virtual]\fR"
Returns the layout's preferred height when it is \fIw\fR pixels wide.
.PP
Reimplemented from TQLayoutItem.
.SH "void TQBoxLayout::insertItem ( int index, TQLayoutItem * item )\fC [protected]\fR"
Inserts \fIitem\fR into this box layout at position \fIindex\fR. If \fIindex\fR is negative, the item is added at the end.
.PP
\fBWarning:\fR Does not call TQLayout::insertChildLayout() if \fIitem\fR is a TQLayout.
.PP
See also addItem() and findWidget().
.SH "void TQBoxLayout::insertLayout ( int index, TQLayout * layout, int stretch = 0 )"
Inserts \fIlayout\fR at position \fIindex\fR, with stretch factor \fIstretch\fR. If \fIindex\fR is negative, the layout is added at the end.
.PP
\fIlayout\fR becomes a child of the box layout.
.PP
See also setAutoAdd(), insertWidget(), and insertSpacing().
.SH "void TQBoxLayout::insertSpacing ( int index, int size )"
Inserts a non-stretchable space at position \fIindex\fR, with size \fIsize\fR. If \fIindex\fR is negative the space is added at the end.
.PP
The box layout has default margin and spacing. This function adds additional space.
.PP
See also insertStretch().
.SH "void TQBoxLayout::insertStretch ( int index, int stretch = 0 )"
Inserts a stretchable space at position \fIindex\fR, with zero minimum size and stretch factor \fIstretch\fR. If \fIindex\fR is negative the space is added at the end.
.PP
See also insertSpacing().
.SH "void TQBoxLayout::insertWidget ( int index, TQWidget * widget, int stretch = 0, int alignment = 0 )"
Inserts \fIwidget\fR at position \fIindex\fR, with stretch factor \fIstretch\fR and alignment \fIalignment\fR. If \fIindex\fR is negative, the widget is added at the end.
.PP
The stretch factor applies only in the direction of the TQBoxLayout, and is relative to the other boxes and widgets in this TQBoxLayout. Widgets and boxes with higher stretch factors grow more.
.PP
If the stretch factor is 0 and nothing else in the TQBoxLayout has a stretch factor greater than zero, the space is distributed according to the TQWidget:sizePolicy() of each widget that's involved.
.PP
Alignment is specified by \fIalignment\fR, which is a bitwise OR of TQt::AlignmentFlags values. The default alignment is 0, which means that the widget fills the entire cell.
.PP
From TQt 3.0, the \fIalignment\fR parameter is interpreted more aggressively than in previous versions of Qt. A non-default alignment now indicates that the widget should not grow to fill the available space, but should be sized according to sizeHint().
.PP
See also setAutoAdd(), insertLayout(), and insertSpacing().
.SH "void TQBoxLayout::invalidate ()\fC [virtual]\fR"
Resets cached information.
.PP
Reimplemented from TQLayout.
.SH "TQSize TQBoxLayout::maximumSize () const\fC [virtual]\fR"
Returns the maximum size needed by this box layout.
.PP
Reimplemented from TQLayout.
.SH "TQSize TQBoxLayout::minimumSize () const\fC [virtual]\fR"
Returns the minimum size needed by this box layout.
.PP
Reimplemented from TQLayout.
.SH "void TQBoxLayout::setDirection ( Direction direction )"
Sets the direction of this layout to \fIdirection\fR.
.SH "void TQBoxLayout::setGeometry ( const TQRect & r )\fC [virtual]\fR"
Resizes managed widgets within the rectangle \fIr\fR.
.PP
Reimplemented from TQLayout.
.SH "bool TQBoxLayout::setStretchFactor ( TQWidget * w, int stretch )"
Sets the stretch factor for widget \fIw\fR to \fIstretch\fR and returns TRUE if \fIw\fR is found in this layout (not including child layouts); otherwise returns FALSE.
.SH "bool TQBoxLayout::setStretchFactor ( TQLayout * l, int stretch )"
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
.PP
Sets the stretch factor for the layout \fIl\fR to \fIstretch\fR and returns TRUE if \fIl\fR is found in this layout (not including child layouts); otherwise returns FALSE.
.SH "TQSize TQBoxLayout::sizeHint () const\fC [virtual]\fR"
Returns the preferred size of this box layout.
.PP
Reimplemented from TQLayoutItem.
.SH "SEE ALSO"
.BR http://doc.trolltech.com/tqboxlayout.html
.BR http://www.trolltech.com/faq/tech.html
.SH COPYRIGHT
Copyright 1992-2007 Trolltech ASA, 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 TQt documentation is provided in HTML format; it is
located at $TQTDIR/doc/html and can be read using TQt 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 [email protected] .
Please include the name of the manual page (tqboxlayout.3qt) and the Qt
version (3.3.8).
|