diff options
Diffstat (limited to 'doc/man/man3/tqboxlayout.3qt')
-rw-r--r-- | doc/man/man3/tqboxlayout.3qt | 354 |
1 files changed, 354 insertions, 0 deletions
diff --git a/doc/man/man3/tqboxlayout.3qt b/doc/man/man3/tqboxlayout.3qt new file mode 100644 index 000000000..318cf83d3 --- /dev/null +++ b/doc/man/man3/tqboxlayout.3qt @@ -0,0 +1,354 @@ +'\" t +.TH QBoxLayout 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 +QBoxLayout \- Lines up child widgets horizontally or vertically +.SH SYNOPSIS +\fC#include <ntqlayout.h>\fR +.PP +Inherits QLayout. +.PP +Inherited by QHBoxLayout and QVBoxLayout. +.PP +.SS "Public Members" +.in +1c +.ti -1c +.BI "enum \fBDirection\fR { LeftToRight, RightToLeft, TopToBottom, BottomToTop, Down = TopToBottom, Up = BottomToTop }" +.br +.ti -1c +.BI "\fBQBoxLayout\fR ( QWidget * parent, Direction d, int margin = 0, int spacing = -1, const char * name = 0 )" +.br +.ti -1c +.BI "\fBQBoxLayout\fR ( QLayout * parentLayout, Direction d, int spacing = -1, const char * name = 0 )" +.br +.ti -1c +.BI "\fBQBoxLayout\fR ( Direction d, int spacing = -1, const char * name = 0 )" +.br +.ti -1c +.BI "\fB~QBoxLayout\fR ()" +.br +.ti -1c +.BI "virtual void \fBaddItem\fR ( QLayoutItem * 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 ( QWidget * widget, int stretch = 0, int alignment = 0 )" +.br +.ti -1c +.BI "void \fBaddLayout\fR ( QLayout * 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, QWidget * widget, int stretch = 0, int alignment = 0 )" +.br +.ti -1c +.BI "void \fBinsertLayout\fR ( int index, QLayout * layout, int stretch = 0 )" +.br +.ti -1c +.BI "bool \fBsetStretchFactor\fR ( QWidget * w, int stretch )" +.br +.ti -1c +.BI "bool \fBsetStretchFactor\fR ( QLayout * l, int stretch )" +.br +.ti -1c +.BI "virtual QSize \fBsizeHint\fR () const" +.br +.ti -1c +.BI "virtual QSize \fBminimumSize\fR () const" +.br +.ti -1c +.BI "virtual QSize \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 QSizePolicy::ExpandData \fBexpanding\fR () const" +.br +.ti -1c +.BI "virtual void \fBinvalidate\fR ()" +.br +.ti -1c +.BI "virtual void \fBsetGeometry\fR ( const QRect & r )" +.br +.ti -1c +.BI "int \fBfindWidget\fR ( QWidget * w )" +.br +.in -1c +.SS "Protected Members" +.in +1c +.ti -1c +.BI "void \fBinsertItem\fR ( int index, QLayoutItem * item )" +.br +.in -1c +.SH DESCRIPTION +The QBoxLayout class lines up child widgets horizontally or vertically. +.PP +QBoxLayout 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 QBoxLayout'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 QBoxLayout's orientation is Vertical, the boxes are placed in a column, again with suitable sizes. +.PP +The easiest way to create a QBoxLayout is to use one of the convenience classes, e.g. QHBoxLayout (for Horizontal boxes) or QVBoxLayout (for Vertical boxes). You can also use the QBoxLayout constructor directly, specifying its direction as LeftToRight, Down, RightToLeft or Up. +.PP +If the QBoxLayout 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 QBoxLayout using one of four functions: +.TP +addWidget() to add a widget to the QBoxLayout 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 QLayout 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 +QBoxLayout 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 QBoxLayout'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 QWidget::hide() on a widget also effectively removes the widget from the layout until QWidget::show() is called. +.PP +You will almost always want to use QVBoxLayout and QHBoxLayout rather than QBoxLayout because of their convenient constructors. +.PP +See also QGrid, Layout Overview, Widget Appearance and Style, and Layout Management. +.SS "Member Type Documentation" +.SH "QBoxLayout::Direction" +This type is used to determine the direction of a box layout. +.TP +\fCQBoxLayout::LeftToRight\fR - Horizontal, from left to right +.TP +\fCQBoxLayout::RightToLeft\fR - Horizontal, from right to left +.TP +\fCQBoxLayout::TopToBottom\fR - Vertical, from top to bottom +.TP +\fCQBoxLayout::Down\fR - The same as TopToBottom +.TP +\fCQBoxLayout::BottomToTop\fR - Vertical, from bottom to top +.TP +\fCQBoxLayout::Up\fR - The same as BottomToTop +.SH MEMBER FUNCTION DOCUMENTATION +.SH "QBoxLayout::QBoxLayout ( QWidget * parent, Direction d, int margin = 0, int spacing = -1, const char * name = 0 )" +Constructs a new QBoxLayout 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 "QBoxLayout::QBoxLayout ( QLayout * parentLayout, Direction d, int spacing = -1, const char * name = 0 )" +Constructs a new QBoxLayout 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 "QBoxLayout::QBoxLayout ( Direction d, int spacing = -1, const char * name = 0 )" +Constructs a new QBoxLayout 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 "QBoxLayout::~QBoxLayout ()" +Destroys this box layout. +.PP +The layout's widgets aren't destroyed. +.SH "void QBoxLayout::addItem ( QLayoutItem * 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 QLayout. +.SH "void QBoxLayout::addLayout ( QLayout * 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-qfont-demo/viewer.cpp, listbox/listbox.cpp, regexptester/regexptester.cpp, and tictac/tictac.cpp. +.SH "void QBoxLayout::addSpacing ( int size )" +Adds a non-stretchable space with size \fIsize\fR to the end of this box layout. QBoxLayout provides default margin and spacing. This function adds additional space. +.PP +See also insertSpacing() and addStretch(). +.PP +Example: listbox/listbox.cpp. +.SH "void QBoxLayout::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 QBoxLayout::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 QBoxLayout::addWidget ( QWidget * 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 QBoxLayout, and is relative to the other boxes and widgets in this QBoxLayout. Widgets and boxes with higher stretch factors grow more. +.PP +If the stretch factor is 0 and nothing else in the QBoxLayout has a stretch factor greater than zero, the space is distributed according to the QWidget:sizePolicy() of each widget that's involved. +.PP +Alignment is specified by \fIalignment\fR which is a bitwise OR of Qt::AlignmentFlags values. The default alignment is 0, which means that the widget fills the entire cell. +.PP +From Qt 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 QBoxLayout::direction () const" +Returns the direction of the box. addWidget() and addSpacing() work in this direction; the stretch stretches in this direction. +.PP +See also QBoxLayout::Direction, addWidget(), and addSpacing(). +.SH "QSizePolicy::ExpandData QBoxLayout::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 QLayout. +.SH "int QBoxLayout::findWidget ( QWidget * 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 QBoxLayout::hasHeightForWidth () const\fC [virtual]\fR" +Returns TRUE if this layout's preferred height depends on its width; otherwise returns FALSE. +.PP +Reimplemented from QLayoutItem. +.SH "int QBoxLayout::heightForWidth ( int w ) const\fC [virtual]\fR" +Returns the layout's preferred height when it is \fIw\fR pixels wide. +.PP +Reimplemented from QLayoutItem. +.SH "void QBoxLayout::insertItem ( int index, QLayoutItem * 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 QLayout::insertChildLayout() if \fIitem\fR is a QLayout. +.PP +See also addItem() and findWidget(). +.SH "void QBoxLayout::insertLayout ( int index, QLayout * 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 QBoxLayout::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 QBoxLayout::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 QBoxLayout::insertWidget ( int index, QWidget * 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 QBoxLayout, and is relative to the other boxes and widgets in this QBoxLayout. Widgets and boxes with higher stretch factors grow more. +.PP +If the stretch factor is 0 and nothing else in the QBoxLayout has a stretch factor greater than zero, the space is distributed according to the QWidget:sizePolicy() of each widget that's involved. +.PP +Alignment is specified by \fIalignment\fR, which is a bitwise OR of Qt::AlignmentFlags values. The default alignment is 0, which means that the widget fills the entire cell. +.PP +From Qt 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 QBoxLayout::invalidate ()\fC [virtual]\fR" +Resets cached information. +.PP +Reimplemented from QLayout. +.SH "QSize QBoxLayout::maximumSize () const\fC [virtual]\fR" +Returns the maximum size needed by this box layout. +.PP +Reimplemented from QLayout. +.SH "QSize QBoxLayout::minimumSize () const\fC [virtual]\fR" +Returns the minimum size needed by this box layout. +.PP +Reimplemented from QLayout. +.SH "void QBoxLayout::setDirection ( Direction direction )" +Sets the direction of this layout to \fIdirection\fR. +.SH "void QBoxLayout::setGeometry ( const QRect & r )\fC [virtual]\fR" +Resizes managed widgets within the rectangle \fIr\fR. +.PP +Reimplemented from QLayout. +.SH "bool QBoxLayout::setStretchFactor ( QWidget * 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 QBoxLayout::setStretchFactor ( QLayout * 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 "QSize QBoxLayout::sizeHint () const\fC [virtual]\fR" +Returns the preferred size of this box layout. +.PP +Reimplemented from QLayoutItem. + +.SH "SEE ALSO" +.BR http://doc.trolltech.com/qboxlayout.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 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 [email protected] . +Please include the name of the manual page (tqboxlayout.3qt) and the Qt +version (3.3.8). |