You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
368 lines
24 KiB
368 lines
24 KiB
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
|
<!-- /home/espenr/tmp/qt-3.3.8-espenr-2499/qt-x11-free-3.3.8/src/kernel/qlayout.cpp:1616 -->
|
|
<html>
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
|
<title>QBoxLayout Class</title>
|
|
<style type="text/css"><!--
|
|
fn { margin-left: 1cm; text-indent: -1cm; }
|
|
a:link { color: #004faf; text-decoration: none }
|
|
a:visited { color: #672967; text-decoration: none }
|
|
body { background: #ffffff; color: black; }
|
|
--></style>
|
|
</head>
|
|
<body>
|
|
|
|
<table border="0" cellpadding="0" cellspacing="0" width="100%">
|
|
<tr bgcolor="#E5E5E5">
|
|
<td valign=center>
|
|
<a href="index.html">
|
|
<font color="#004faf">Home</font></a>
|
|
| <a href="classes.html">
|
|
<font color="#004faf">All Classes</font></a>
|
|
| <a href="mainclasses.html">
|
|
<font color="#004faf">Main Classes</font></a>
|
|
| <a href="annotated.html">
|
|
<font color="#004faf">Annotated</font></a>
|
|
| <a href="groups.html">
|
|
<font color="#004faf">Grouped Classes</font></a>
|
|
| <a href="functions.html">
|
|
<font color="#004faf">Functions</font></a>
|
|
</td>
|
|
<td align="right" valign="center"><img src="logo32.png" align="right" width="64" height="32" border="0"></td></tr></table><h1 align=center>QBoxLayout Class Reference</h1>
|
|
|
|
<p>The QBoxLayout class lines up child widgets horizontally or
|
|
vertically.
|
|
<a href="#details">More...</a>
|
|
<p><tt>#include <<a href="qlayout-h.html">qlayout.h</a>></tt>
|
|
<p>Inherits <a href="qlayout.html">QLayout</a>.
|
|
<p>Inherited by <a href="qhboxlayout.html">QHBoxLayout</a> and <a href="qvboxlayout.html">QVBoxLayout</a>.
|
|
<p><a href="qboxlayout-members.html">List of all member functions.</a>
|
|
<h2>Public Members</h2>
|
|
<ul>
|
|
<li class=fn>enum <a href="#Direction-enum"><b>Direction</b></a> { LeftToRight, RightToLeft, TopToBottom, BottomToTop, Down = TopToBottom, Up = BottomToTop }</li>
|
|
<li class=fn><a href="#QBoxLayout"><b>QBoxLayout</b></a> ( QWidget * parent, Direction d, int margin = 0, int spacing = -1, const char * name = 0 )</li>
|
|
<li class=fn><a href="#QBoxLayout-2"><b>QBoxLayout</b></a> ( QLayout * parentLayout, Direction d, int spacing = -1, const char * name = 0 )</li>
|
|
<li class=fn><a href="#QBoxLayout-3"><b>QBoxLayout</b></a> ( Direction d, int spacing = -1, const char * name = 0 )</li>
|
|
<li class=fn><a href="#~QBoxLayout"><b>~QBoxLayout</b></a> ()</li>
|
|
<li class=fn>virtual void <a href="#addItem"><b>addItem</b></a> ( QLayoutItem * item )</li>
|
|
<li class=fn>Direction <a href="#direction"><b>direction</b></a> () const</li>
|
|
<li class=fn>void <a href="#setDirection"><b>setDirection</b></a> ( Direction direction )</li>
|
|
<li class=fn>void <a href="#addSpacing"><b>addSpacing</b></a> ( int size )</li>
|
|
<li class=fn>void <a href="#addStretch"><b>addStretch</b></a> ( int stretch = 0 )</li>
|
|
<li class=fn>void <a href="#addWidget"><b>addWidget</b></a> ( QWidget * widget, int stretch = 0, int alignment = 0 )</li>
|
|
<li class=fn>void <a href="#addLayout"><b>addLayout</b></a> ( QLayout * layout, int stretch = 0 )</li>
|
|
<li class=fn>void <a href="#addStrut"><b>addStrut</b></a> ( int size )</li>
|
|
<li class=fn>void <a href="#insertSpacing"><b>insertSpacing</b></a> ( int index, int size )</li>
|
|
<li class=fn>void <a href="#insertStretch"><b>insertStretch</b></a> ( int index, int stretch = 0 )</li>
|
|
<li class=fn>void <a href="#insertWidget"><b>insertWidget</b></a> ( int index, QWidget * widget, int stretch = 0, int alignment = 0 )</li>
|
|
<li class=fn>void <a href="#insertLayout"><b>insertLayout</b></a> ( int index, QLayout * layout, int stretch = 0 )</li>
|
|
<li class=fn>bool <a href="#setStretchFactor"><b>setStretchFactor</b></a> ( QWidget * w, int stretch )</li>
|
|
<li class=fn>bool <a href="#setStretchFactor-2"><b>setStretchFactor</b></a> ( QLayout * l, int stretch )</li>
|
|
<li class=fn>virtual QSize <a href="#sizeHint"><b>sizeHint</b></a> () const</li>
|
|
<li class=fn>virtual QSize <a href="#minimumSize"><b>minimumSize</b></a> () const</li>
|
|
<li class=fn>virtual QSize <a href="#maximumSize"><b>maximumSize</b></a> () const</li>
|
|
<li class=fn>virtual bool <a href="#hasHeightForWidth"><b>hasHeightForWidth</b></a> () const</li>
|
|
<li class=fn>virtual int <a href="#heightForWidth"><b>heightForWidth</b></a> ( int w ) const</li>
|
|
<li class=fn>virtual QSizePolicy::ExpandData <a href="#expanding"><b>expanding</b></a> () const</li>
|
|
<li class=fn>virtual void <a href="#invalidate"><b>invalidate</b></a> ()</li>
|
|
<li class=fn>virtual void <a href="#setGeometry"><b>setGeometry</b></a> ( const QRect & r )</li>
|
|
<li class=fn>int <a href="#findWidget"><b>findWidget</b></a> ( QWidget * w )</li>
|
|
</ul>
|
|
<h2>Protected Members</h2>
|
|
<ul>
|
|
<li class=fn>void <a href="#insertItem"><b>insertItem</b></a> ( int index, QLayoutItem * item )</li>
|
|
</ul>
|
|
<hr><a name="details"></a><h2>Detailed Description</h2>
|
|
|
|
|
|
<p> The QBoxLayout class lines up child widgets horizontally or
|
|
vertically.
|
|
<p>
|
|
|
|
<p> QBoxLayout takes the space it gets (from its parent layout or from
|
|
the <a href="qlayout.html#mainWidget">mainWidget</a>()), divides it up into a row of boxes, and makes
|
|
each managed widget fill one box.
|
|
<p> <center><img src="qhbox-m.png" alt="Horizontal box with five child widgets"></center>
|
|
<p> If the QBoxLayout's orientation is <a href="qt.html#Orientation-enum">Horizontal</a> 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).
|
|
<p> <center><img src="qvbox-m.png" alt="Vertical box with five child widgets"></center>
|
|
<p> If the QBoxLayout's orientation is <a href="qt.html#Orientation-enum">Vertical</a>, the boxes are
|
|
placed in a column, again with suitable sizes.
|
|
<p> The easiest way to create a QBoxLayout is to use one of the
|
|
convenience classes, e.g. <a href="qhboxlayout.html">QHBoxLayout</a> (for <a href="qt.html#Orientation-enum">Horizontal</a> boxes) or
|
|
<a href="qvboxlayout.html">QVBoxLayout</a> (for <a href="qt.html#Orientation-enum">Vertical</a> boxes). You can also use the
|
|
QBoxLayout constructor directly, specifying its direction as <a href="#Direction-enum">LeftToRight</a>, <a href="#Direction-enum">Down</a>, <a href="#Direction-enum">RightToLeft</a> or <a href="#Direction-enum">Up</a>.
|
|
<p> 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().
|
|
<p> Once you have done this, you can add boxes to the QBoxLayout using
|
|
one of four functions:
|
|
<p> <ul>
|
|
<li> <a href="#addWidget">addWidget</a>() to add a widget to the QBoxLayout and set the
|
|
widget's <a href="layout.html#stretch-factor">stretch factor</a>. (The stretch factor is along the row of
|
|
boxes.)
|
|
<p> <li> <a href="#addSpacing">addSpacing</a>() 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.
|
|
<p> <li> <a href="#addStretch">addStretch</a>() to create an empty, stretchable box.
|
|
<p> <li> <a href="#addLayout">addLayout</a>() to add a box containing another <a href="qlayout.html">QLayout</a> to the row
|
|
and set that layout's stretch factor.
|
|
</ul>
|
|
<p> Use <a href="#insertWidget">insertWidget</a>(), <a href="#insertSpacing">insertSpacing</a>(), <a href="#insertStretch">insertStretch</a>() or
|
|
<a href="#insertLayout">insertLayout</a>() to insert a box at a specified position in the
|
|
layout.
|
|
<p> QBoxLayout also includes two margin widths:
|
|
<p> <ul>
|
|
<li> <a href="qlayout.html#setMargin">setMargin</a>() sets the width of the outer border. This is the width
|
|
of the reserved space along each of the QBoxLayout's four sides.
|
|
<li> <a href="qlayout.html#setSpacing">setSpacing</a>() sets the width between neighboring boxes. (You
|
|
can use <a href="#addSpacing">addSpacing</a>() to get more space at a particular spot.)
|
|
</ul>
|
|
<p> 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.
|
|
<p> To remove a widget from a layout, call <a href="qlayout.html#remove">remove</a>(). Calling
|
|
<a href="qwidget.html#hide">QWidget::hide</a>() on a widget also effectively removes the widget
|
|
from the layout until <a href="qwidget.html#show">QWidget::show</a>() is called.
|
|
<p> You will almost always want to use <a href="qvboxlayout.html">QVBoxLayout</a> and <a href="qhboxlayout.html">QHBoxLayout</a>
|
|
rather than QBoxLayout because of their convenient constructors.
|
|
<p> <p>See also <a href="qgrid.html">QGrid</a>, <a href="layout.html">Layout Overview</a>, <a href="appearance.html">Widget Appearance and Style</a>, and <a href="geomanagement.html">Layout Management</a>.
|
|
|
|
<hr><h2>Member Type Documentation</h2>
|
|
<h3 class=fn><a name="Direction-enum"></a>QBoxLayout::Direction</h3>
|
|
|
|
<p> This type is used to determine the direction of a box layout.
|
|
<ul>
|
|
<li><tt>QBoxLayout::LeftToRight</tt> - Horizontal, from left to right
|
|
<li><tt>QBoxLayout::RightToLeft</tt> - Horizontal, from right to left
|
|
<li><tt>QBoxLayout::TopToBottom</tt> - Vertical, from top to bottom
|
|
<li><tt>QBoxLayout::Down</tt> - The same as <a href="#Direction-enum">TopToBottom</a>
|
|
<li><tt>QBoxLayout::BottomToTop</tt> - Vertical, from bottom to top
|
|
<li><tt>QBoxLayout::Up</tt> - The same as <a href="#Direction-enum">BottomToTop</a>
|
|
</ul>
|
|
<hr><h2>Member Function Documentation</h2>
|
|
<h3 class=fn><a name="QBoxLayout"></a>QBoxLayout::QBoxLayout ( <a href="qwidget.html">QWidget</a> * parent, <a href="qboxlayout.html#Direction-enum">Direction</a> d, int margin = 0, int spacing = -1, const char * name = 0 )
|
|
</h3>
|
|
Constructs a new QBoxLayout with direction <em>d</em> and main widget <em>parent</em>. <em>parent</em> may not be 0.
|
|
<p> The <em>margin</em> is the number of pixels between the edge of the
|
|
widget and its managed children. The <em>spacing</em> is the default
|
|
number of pixels between neighboring children. If <em>spacing</em> is -1
|
|
the value of <em>margin</em> is used for <em>spacing</em>.
|
|
<p> <em>name</em> is the internal object name.
|
|
<p> <p>See also <a href="#direction">direction</a>().
|
|
|
|
<h3 class=fn><a name="QBoxLayout-2"></a>QBoxLayout::QBoxLayout ( <a href="qlayout.html">QLayout</a> * parentLayout, <a href="qboxlayout.html#Direction-enum">Direction</a> d, int spacing = -1, const char * name = 0 )
|
|
</h3>
|
|
Constructs a new QBoxLayout called <em>name</em>, with direction <em>d</em>,
|
|
and inserts it into <em>parentLayout</em>.
|
|
<p> The <em>spacing</em> is the default number of pixels between neighboring
|
|
children. If <em>spacing</em> is -1, the layout will inherit its
|
|
parent's <a href="qlayout.html#spacing">spacing</a>().
|
|
|
|
<h3 class=fn><a name="QBoxLayout-3"></a>QBoxLayout::QBoxLayout ( <a href="qboxlayout.html#Direction-enum">Direction</a> d, int spacing = -1, const char * name = 0 )
|
|
</h3>
|
|
Constructs a new QBoxLayout called <em>name</em>, with direction <em>d</em>.
|
|
<p> If <em>spacing</em> is -1, the layout will inherit its parent's
|
|
<a href="qlayout.html#spacing">spacing</a>(); otherwise <em>spacing</em> is used.
|
|
<p> You must insert this box into another layout.
|
|
|
|
<h3 class=fn><a name="~QBoxLayout"></a>QBoxLayout::~QBoxLayout ()
|
|
</h3>
|
|
Destroys this box layout.
|
|
<p> The layout's widgets aren't destroyed.
|
|
|
|
<h3 class=fn>void <a name="addItem"></a>QBoxLayout::addItem ( <a href="qlayoutitem.html">QLayoutItem</a> * item )<tt> [virtual]</tt>
|
|
</h3>
|
|
Adds <em>item</em> to the end of this box layout.
|
|
|
|
<p>Examples: <a href="tutorial2-09.html#x2629">chart/optionsform.cpp</a> and <a href="tutorial2-08.html#x2593">chart/setdataform.cpp</a>.
|
|
<p>Reimplemented from <a href="qlayout.html#addItem">QLayout</a>.
|
|
<h3 class=fn>void <a name="addLayout"></a>QBoxLayout::addLayout ( <a href="qlayout.html">QLayout</a> * layout, int stretch = 0 )
|
|
</h3>
|
|
Adds <em>layout</em> to the end of the box, with serial <a href="layout.html#stretch-factor">stretch factor</a>
|
|
<em>stretch</em>.
|
|
<p> When a layout is constructed with another layout as its parent,
|
|
you don't need to call <a href="#addLayout">addLayout</a>(); the child layout is
|
|
automatically added to the parent layout as it is constructed.
|
|
<p> <p>See also <a href="#insertLayout">insertLayout</a>(), <a href="qlayout.html#setAutoAdd">setAutoAdd</a>(), <a href="#addWidget">addWidget</a>(), and <a href="#addSpacing">addSpacing</a>().
|
|
|
|
<p>Examples: <a href="tutorial2-09.html#x2630">chart/optionsform.cpp</a>, <a href="tutorial2-08.html#x2594">chart/setdataform.cpp</a>, <a href="simple-font-demo-example.html#x2835">fonts/simple-qfont-demo/viewer.cpp</a>, <a href="listbox-example.html#x1422">listbox/listbox.cpp</a>, <a href="regexptester-example.html#x2469">regexptester/regexptester.cpp</a>, and <a href="tictac-example.html#x19">tictac/tictac.cpp</a>.
|
|
<h3 class=fn>void <a name="addSpacing"></a>QBoxLayout::addSpacing ( int size )
|
|
</h3>
|
|
Adds a non-stretchable space with size <em>size</em> to the end of this
|
|
box layout. QBoxLayout provides default margin and spacing. This
|
|
function adds additional space.
|
|
<p> <p>See also <a href="#insertSpacing">insertSpacing</a>() and <a href="#addStretch">addStretch</a>().
|
|
|
|
<p>Example: <a href="listbox-example.html#x1423">listbox/listbox.cpp</a>.
|
|
<h3 class=fn>void <a name="addStretch"></a>QBoxLayout::addStretch ( int stretch = 0 )
|
|
</h3>
|
|
Adds a stretchable space with zero minimum size and <a href="layout.html#stretch-factor">stretch factor</a>
|
|
<em>stretch</em> to the end of this box layout.
|
|
<p> <p>See also <a href="#addSpacing">addSpacing</a>().
|
|
|
|
<p>Examples: <a href="layout-example.html#x528">layout/layout.cpp</a>, <a href="listbox-example.html#x1424">listbox/listbox.cpp</a>, <a href="regexptester-example.html#x2470">regexptester/regexptester.cpp</a>, and <a href="tutorial1-13.html#x2410">t13/gamebrd.cpp</a>.
|
|
<h3 class=fn>void <a name="addStrut"></a>QBoxLayout::addStrut ( int size )
|
|
</h3>
|
|
Limits the perpendicular dimension of the box (e.g. height if the
|
|
box is LeftToRight) to a minimum of <em>size</em>. Other constraints may
|
|
increase the limit.
|
|
|
|
<h3 class=fn>void <a name="addWidget"></a>QBoxLayout::addWidget ( <a href="qwidget.html">QWidget</a> * widget, int stretch = 0, int alignment = 0 )
|
|
</h3>
|
|
Adds <em>widget</em> to the end of this box layout, with a <a href="layout.html#stretch-factor">stretch factor</a> of <em>stretch</em> and alignment <em>alignment</em>.
|
|
<p> The stretch factor applies only in the <a href="#direction">direction</a> of the QBoxLayout, and is relative to the other boxes and
|
|
widgets in this QBoxLayout. Widgets and boxes with higher stretch
|
|
factors grow more.
|
|
<p> 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.
|
|
<p> Alignment is specified by <em>alignment</em> which is a bitwise OR of <a href="qt.html#AlignmentFlags-enum">Qt::AlignmentFlags</a> values. The default alignment is 0, which means
|
|
that the widget fills the entire cell.
|
|
<p> From Qt 3.0, the <em>alignment</em> 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 <a href="#sizeHint">sizeHint</a>().
|
|
<p> <p>See also <a href="#insertWidget">insertWidget</a>(), <a href="qlayout.html#setAutoAdd">setAutoAdd</a>(), <a href="#addLayout">addLayout</a>(), and <a href="#addSpacing">addSpacing</a>().
|
|
|
|
<p>Examples: <a href="tutorial2-09.html#x2631">chart/optionsform.cpp</a>, <a href="checklists-example.html#x423">checklists/checklists.cpp</a>, <a href="layout-example.html#x529">layout/layout.cpp</a>, <a href="lineedits-example.html#x169">lineedits/lineedits.cpp</a>, <a href="listbox-example.html#x1425">listbox/listbox.cpp</a>, <a href="tutorial1-13.html#x2411">t13/gamebrd.cpp</a>, and <a href="tutorial1-13.html#x2401">t13/lcdrange.cpp</a>.
|
|
<h3 class=fn><a href="qboxlayout.html#Direction-enum">Direction</a> <a name="direction"></a>QBoxLayout::direction () const
|
|
</h3>
|
|
|
|
<p> Returns the direction of the box. <a href="#addWidget">addWidget</a>() and <a href="#addSpacing">addSpacing</a>()
|
|
work in this direction; the stretch stretches in this direction.
|
|
<p> <p>See also <a href="#Direction-enum">QBoxLayout::Direction</a>, <a href="#addWidget">addWidget</a>(), and <a href="#addSpacing">addSpacing</a>().
|
|
|
|
<h3 class=fn><a href="qsizepolicy.html#ExpandData-enum">QSizePolicy::ExpandData</a> <a name="expanding"></a>QBoxLayout::expanding () const<tt> [virtual]</tt>
|
|
</h3>
|
|
Returns whether this layout can make use of more space than
|
|
<a href="#sizeHint">sizeHint</a>(). A value of <a href="qt.html#Orientation-enum">Vertical</a> or <a href="qt.html#Orientation-enum">Horizontal</a> means that it wants
|
|
to grow in only one dimension, whereas <tt>BothDirections</tt> means that
|
|
it wants to grow in both dimensions.
|
|
|
|
<p>Reimplemented from <a href="qlayout.html#expanding">QLayout</a>.
|
|
<h3 class=fn>int <a name="findWidget"></a>QBoxLayout::findWidget ( <a href="qwidget.html">QWidget</a> * w )
|
|
</h3>
|
|
Searches for widget <em>w</em> in this layout (not including child
|
|
layouts).
|
|
<p> Returns the index of <em>w</em>, or -1 if <em>w</em> is not found.
|
|
|
|
<h3 class=fn>bool <a name="hasHeightForWidth"></a>QBoxLayout::hasHeightForWidth () const<tt> [virtual]</tt>
|
|
</h3>
|
|
Returns TRUE if this layout's preferred height depends on its width;
|
|
otherwise returns FALSE.
|
|
|
|
<p>Reimplemented from <a href="qlayoutitem.html#hasHeightForWidth">QLayoutItem</a>.
|
|
<h3 class=fn>int <a name="heightForWidth"></a>QBoxLayout::heightForWidth ( int w ) const<tt> [virtual]</tt>
|
|
</h3>
|
|
Returns the layout's preferred height when it is <em>w</em> pixels wide.
|
|
|
|
<p>Reimplemented from <a href="qlayoutitem.html#heightForWidth">QLayoutItem</a>.
|
|
<h3 class=fn>void <a name="insertItem"></a>QBoxLayout::insertItem ( int index, <a href="qlayoutitem.html">QLayoutItem</a> * item )<tt> [protected]</tt>
|
|
</h3>
|
|
Inserts <em>item</em> into this box layout at position <em>index</em>. If <em>index</em> is negative, the item is added at the end.
|
|
<p> <b>Warning:</b> Does not call QLayout::insertChildLayout() if <em>item</em> is
|
|
a <a href="qlayout.html">QLayout</a>.
|
|
<p> <p>See also <a href="#addItem">addItem</a>() and <a href="#findWidget">findWidget</a>().
|
|
|
|
<h3 class=fn>void <a name="insertLayout"></a>QBoxLayout::insertLayout ( int index, <a href="qlayout.html">QLayout</a> * layout, int stretch = 0 )
|
|
</h3>
|
|
Inserts <em>layout</em> at position <em>index</em>, with <a href="layout.html#stretch-factor">stretch factor</a> <em>stretch</em>. If <em>index</em> is negative, the layout is added at the end.
|
|
<p> <em>layout</em> becomes a child of the box layout.
|
|
<p> <p>See also <a href="qlayout.html#setAutoAdd">setAutoAdd</a>(), <a href="#insertWidget">insertWidget</a>(), and <a href="#insertSpacing">insertSpacing</a>().
|
|
|
|
<h3 class=fn>void <a name="insertSpacing"></a>QBoxLayout::insertSpacing ( int index, int size )
|
|
</h3>
|
|
Inserts a non-stretchable space at position <em>index</em>, with size <em>size</em>. If <em>index</em> is negative the space is added at the end.
|
|
<p> The box layout has default margin and spacing. This function adds
|
|
additional space.
|
|
<p> <p>See also <a href="#insertStretch">insertStretch</a>().
|
|
|
|
<h3 class=fn>void <a name="insertStretch"></a>QBoxLayout::insertStretch ( int index, int stretch = 0 )
|
|
</h3>
|
|
Inserts a stretchable space at position <em>index</em>, with zero
|
|
minimum size and <a href="layout.html#stretch-factor">stretch factor</a> <em>stretch</em>. If <em>index</em> is
|
|
negative the space is added at the end.
|
|
<p> <p>See also <a href="#insertSpacing">insertSpacing</a>().
|
|
|
|
<h3 class=fn>void <a name="insertWidget"></a>QBoxLayout::insertWidget ( int index, <a href="qwidget.html">QWidget</a> * widget, int stretch = 0, int alignment = 0 )
|
|
</h3>
|
|
Inserts <em>widget</em> at position <em>index</em>, with <a href="layout.html#stretch-factor">stretch factor</a> <em>stretch</em> and alignment <em>alignment</em>. If <em>index</em> is negative, the
|
|
widget is added at the end.
|
|
<p> The stretch factor applies only in the <a href="#direction">direction</a> of the QBoxLayout, and is relative to the other boxes and
|
|
widgets in this QBoxLayout. Widgets and boxes with higher stretch
|
|
factors grow more.
|
|
<p> 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.
|
|
<p> Alignment is specified by <em>alignment</em>, which is a bitwise OR of
|
|
<a href="qt.html#AlignmentFlags-enum">Qt::AlignmentFlags</a> values. The default alignment is 0, which
|
|
means that the widget fills the entire cell.
|
|
<p> From Qt 3.0, the <em>alignment</em> 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 <a href="#sizeHint">sizeHint</a>().
|
|
<p> <p>See also <a href="qlayout.html#setAutoAdd">setAutoAdd</a>(), <a href="#insertLayout">insertLayout</a>(), and <a href="#insertSpacing">insertSpacing</a>().
|
|
|
|
<h3 class=fn>void <a name="invalidate"></a>QBoxLayout::invalidate ()<tt> [virtual]</tt>
|
|
</h3>
|
|
Resets cached information.
|
|
|
|
<p>Reimplemented from <a href="qlayout.html#invalidate">QLayout</a>.
|
|
<h3 class=fn><a href="qsize.html">QSize</a> <a name="maximumSize"></a>QBoxLayout::maximumSize () const<tt> [virtual]</tt>
|
|
</h3>
|
|
Returns the maximum size needed by this box layout.
|
|
|
|
<p>Reimplemented from <a href="qlayout.html#maximumSize">QLayout</a>.
|
|
<h3 class=fn><a href="qsize.html">QSize</a> <a name="minimumSize"></a>QBoxLayout::minimumSize () const<tt> [virtual]</tt>
|
|
</h3>
|
|
Returns the minimum size needed by this box layout.
|
|
|
|
<p>Reimplemented from <a href="qlayout.html#minimumSize">QLayout</a>.
|
|
<h3 class=fn>void <a name="setDirection"></a>QBoxLayout::setDirection ( <a href="qboxlayout.html#Direction-enum">Direction</a> direction )
|
|
</h3>
|
|
Sets the direction of this layout to <em>direction</em>.
|
|
|
|
<h3 class=fn>void <a name="setGeometry"></a>QBoxLayout::setGeometry ( const <a href="qrect.html">QRect</a> & r )<tt> [virtual]</tt>
|
|
</h3>
|
|
Resizes managed widgets within the rectangle <em>r</em>.
|
|
|
|
<p>Reimplemented from <a href="qlayout.html#setGeometry">QLayout</a>.
|
|
<h3 class=fn>bool <a name="setStretchFactor"></a>QBoxLayout::setStretchFactor ( <a href="qwidget.html">QWidget</a> * w, int stretch )
|
|
</h3>
|
|
Sets the <a href="layout.html#stretch-factor">stretch factor</a> for widget <em>w</em> to <em>stretch</em> and returns
|
|
TRUE if <em>w</em> is found in this layout (not including child
|
|
layouts); otherwise returns FALSE.
|
|
|
|
<h3 class=fn>bool <a name="setStretchFactor-2"></a>QBoxLayout::setStretchFactor ( <a href="qlayout.html">QLayout</a> * l, int stretch )
|
|
</h3>
|
|
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
|
<p> Sets the <a href="layout.html#stretch-factor">stretch factor</a> for the layout <em>l</em> to <em>stretch</em> and
|
|
returns TRUE if <em>l</em> is found in this layout (not including child
|
|
layouts); otherwise returns FALSE.
|
|
|
|
<h3 class=fn><a href="qsize.html">QSize</a> <a name="sizeHint"></a>QBoxLayout::sizeHint () const<tt> [virtual]</tt>
|
|
</h3>
|
|
Returns the preferred size of this box layout.
|
|
|
|
<p>Reimplemented from <a href="qlayoutitem.html#sizeHint">QLayoutItem</a>.
|
|
<!-- eof -->
|
|
<hr><p>
|
|
This file is part of the <a href="index.html">Qt toolkit</a>.
|
|
Copyright © 1995-2007
|
|
<a href="http://www.trolltech.com/">Trolltech</a>. All Rights Reserved.<p><address><hr><div align=center>
|
|
<table width=100% cellspacing=0 border=0><tr>
|
|
<td>Copyright © 2007
|
|
<a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
|
|
<td align=right><div align=right>Qt 3.3.8</div>
|
|
</table></div></address></body>
|
|
</html>
|