⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 qboxlayout.html

📁 QT 下载资料仅供参考
💻 HTML
📖 第 1 页 / 共 2 页
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><!-- /home/reggie/tmp/qt-3.0-reggie-5401/qt-x11-commercial-3.0.5/src/kernel/qlayout.cpp:1502 --><html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>QBoxLayout Class</title><style type="text/css"><!--h3.fn,span.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&nbsp;Classes</font></a> | <a href="mainclasses.html"><font color="#004faf">Main&nbsp;Classes</font></a> | <a href="annotated.html"><font color="#004faf">Annotated</font></a> | <a href="groups.html"><font color="#004faf">Grouped&nbsp;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 orvertically.<a href="#details">More...</a><p><tt>#include &lt;<a href="qlayout-h.html">qlayout.h</a>&gt;</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><div class=fn>enum <a href="#Direction-enum"><b>Direction</b></a> { LeftToRight, RightToLeft, TopToBottom, BottomToTop, Down = TopToBottom, Up = BottomToTop }</div></li><li><div class=fn><a href="#QBoxLayout"><b>QBoxLayout</b></a> ( QWidget&nbsp;*&nbsp;parent, Direction&nbsp;d, int&nbsp;margin = 0, int&nbsp;spacing = -1, const&nbsp;char&nbsp;*&nbsp;name = 0 )</div></li><li><div class=fn><a href="#QBoxLayout-2"><b>QBoxLayout</b></a> ( QLayout&nbsp;*&nbsp;parentLayout, Direction&nbsp;d, int&nbsp;spacing = -1, const&nbsp;char&nbsp;*&nbsp;name = 0 )</div></li><li><div class=fn><a href="#QBoxLayout-3"><b>QBoxLayout</b></a> ( Direction&nbsp;d, int&nbsp;spacing = -1, const&nbsp;char&nbsp;*&nbsp;name = 0 )</div></li><li><div class=fn><a href="#~QBoxLayout"><b>~QBoxLayout</b></a> ()</div></li><li><div class=fn>virtual void <a href="#addItem"><b>addItem</b></a> ( QLayoutItem&nbsp;*&nbsp;item )</div></li><li><div class=fn>Direction <a href="#direction"><b>direction</b></a> () const</div></li><li><div class=fn>void <a href="#setDirection"><b>setDirection</b></a> ( Direction&nbsp;direction )</div></li><li><div class=fn>void <a href="#addSpacing"><b>addSpacing</b></a> ( int&nbsp;size )</div></li><li><div class=fn>void <a href="#addStretch"><b>addStretch</b></a> ( int&nbsp;stretch = 0 )</div></li><li><div class=fn>void <a href="#addWidget"><b>addWidget</b></a> ( QWidget&nbsp;*&nbsp;widget, int&nbsp;stretch = 0, int&nbsp;alignment = 0 )</div></li><li><div class=fn>void <a href="#addLayout"><b>addLayout</b></a> ( QLayout&nbsp;*&nbsp;layout, int&nbsp;stretch = 0 )</div></li><li><div class=fn>void <a href="#addStrut"><b>addStrut</b></a> ( int&nbsp;size )</div></li><li><div class=fn>void <a href="#insertSpacing"><b>insertSpacing</b></a> ( int&nbsp;index, int&nbsp;size )</div></li><li><div class=fn>void <a href="#insertStretch"><b>insertStretch</b></a> ( int&nbsp;index, int&nbsp;stretch = 0 )</div></li><li><div class=fn>void <a href="#insertWidget"><b>insertWidget</b></a> ( int&nbsp;index, QWidget&nbsp;*&nbsp;widget, int&nbsp;stretch = 0, int&nbsp;alignment = 0 )</div></li><li><div class=fn>void <a href="#insertLayout"><b>insertLayout</b></a> ( int&nbsp;index, QLayout&nbsp;*&nbsp;layout, int&nbsp;stretch = 0 )</div></li><li><div class=fn>bool <a href="#setStretchFactor"><b>setStretchFactor</b></a> ( QWidget&nbsp;*&nbsp;w, int&nbsp;stretch )</div></li><li><div class=fn>bool <a href="#setStretchFactor-2"><b>setStretchFactor</b></a> ( QLayout&nbsp;*&nbsp;l, int&nbsp;stretch )</div></li><li><div class=fn>virtual QSize <a href="#sizeHint"><b>sizeHint</b></a> () const</div></li><li><div class=fn>virtual QSize <a href="#minimumSize"><b>minimumSize</b></a> () const</div></li><li><div class=fn>virtual QSize <a href="#maximumSize"><b>maximumSize</b></a> () const</div></li><li><div class=fn>virtual bool <a href="#hasHeightForWidth"><b>hasHeightForWidth</b></a> () const</div></li><li><div class=fn>virtual int <a href="#heightForWidth"><b>heightForWidth</b></a> ( int&nbsp;w ) const</div></li><li><div class=fn>virtual QSizePolicy::ExpandData <a href="#expanding"><b>expanding</b></a> () const</div></li><li><div class=fn>virtual void <a href="#invalidate"><b>invalidate</b></a> ()</div></li><li><div class=fn>virtual void <a href="#setGeometry"><b>setGeometry</b></a> ( const&nbsp;QRect&nbsp;&amp;&nbsp;r )</div></li><li><div class=fn>int <a href="#findWidget"><b>findWidget</b></a> ( QWidget&nbsp;*&nbsp;w )</div></li></ul><h2>Protected Members</h2><ul><li><div class=fn>void <a href="#insertItem"><b>insertItem</b></a> ( int&nbsp;index, QLayoutItem&nbsp;*&nbsp;item )</div></li></ul><hr><a name="details"></a><h2>Detailed Description</h2><p> The QBoxLayout class lines up child widgets horizontally orvertically.<p> <p> QBoxLayout takes the space it gets (from its parent layout or fromthe <a href="qlayout.html#mainWidget">mainWidget</a>()), divides it up into a row of boxes, and makeseach 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 areplaced 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 (moreabout 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 areplaced in a column, again with suitable sizes.<p> The easiest way to create a QBoxLayout is to use one of theconvenience 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 theQBoxLayout 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 notmanaging all of the widget's area and children), you must add itto its parent layout before you can do anything with it. Thenormal way to add a layout is by callingparentLayout-&gt;addLayout().<p> Once you have done this, you can add boxes to the QBoxLayout usingone of four functions:<p> <ul><li> <a href="#addWidget">addWidget</a>() to add a widget to the QBoxLayout and set thewidget's <a href="layout.html#stretch-factor">stretch factor</a>. (The stretch factor is along the row ofboxes.)<p> <li> <a href="#addSpacing">addSpacing</a>() to create an empty box; this is one of thefunctions you use to create nice and spacious dialogs. See belowfor 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 rowand 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 thelayout.<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 widthof 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. (Youcan 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 themargin width for a top-level layout, or to the same as the parentlayout. Both are parameters to the constructor.<p> To remove a widget from a layout, either delete it or reparent itwith <a href="qwidget.html#reparent">QWidget::reparent</a>(). Hiding a widget with <a href="qwidget.html#hide">QWidget::hide</a>()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>&nbsp;*&nbsp;parent, <a href="qboxlayout.html#Direction-enum">Direction</a>&nbsp;d, int&nbsp;margin = 0, int&nbsp;spacing = -1, const&nbsp;char&nbsp;*&nbsp;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 thewidget and its managed children. The <em>spacing</em> is the defaultnumber of pixels between neighboring children. If <em>spacing</em> is -1the 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>&nbsp;*&nbsp;parentLayout, <a href="qboxlayout.html#Direction-enum">Direction</a>&nbsp;d, int&nbsp;spacing = -1, const&nbsp;char&nbsp;*&nbsp;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 neighboringchildren. If <em>spacing</em> is -1, the layout will inherit itsparent'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>&nbsp;d, int&nbsp;spacing = -1, const&nbsp;char&nbsp;*&nbsp;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 are <em>not</em> destroyed.<h3 class=fn>void <a name="addItem"></a>QBoxLayout::addItem ( <a href="qlayoutitem.html">QLayoutItem</a>&nbsp;*&nbsp;item )<tt> [virtual]</tt>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -