qlayoutitem.html
来自「QT 下载资料仅供参考」· HTML 代码 · 共 231 行
HTML
231 行
<!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/qabstractlayout.cpp:46 --><html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>QLayoutItem 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 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>QLayoutItem Class Reference</h1><p>The QLayoutItem class provides an abstract item that aQLayout manipulates.<a href="#details">More...</a><p><tt>#include <<a href="qlayout-h.html">qlayout.h</a>></tt><p>Inherited by <a href="qlayout.html">QLayout</a>, <a href="qspaceritem.html">QSpacerItem</a> and <a href="qwidgetitem.html">QWidgetItem</a>.<p><a href="qlayoutitem-members.html">List of all member functions.</a><h2>Public Members</h2><ul><li><div class=fn><a href="#QLayoutItem"><b>QLayoutItem</b></a> ( int alignment = 0 )</div></li><li><div class=fn>virtual <a href="#~QLayoutItem"><b>~QLayoutItem</b></a> ()</div></li><li><div class=fn>virtual QSize <a href="#sizeHint"><b>sizeHint</b></a> () const = 0</div></li><li><div class=fn>virtual QSize <a href="#minimumSize"><b>minimumSize</b></a> () const = 0</div></li><li><div class=fn>virtual QSize <a href="#maximumSize"><b>maximumSize</b></a> () const = 0</div></li><li><div class=fn>virtual QSizePolicy::ExpandData <a href="#expanding"><b>expanding</b></a> () const = 0</div></li><li><div class=fn>virtual void <a href="#setGeometry"><b>setGeometry</b></a> ( const QRect & r ) = 0</div></li><li><div class=fn>virtual QRect <a href="#geometry"><b>geometry</b></a> () const = 0</div></li><li><div class=fn>virtual bool <a href="#isEmpty"><b>isEmpty</b></a> () const = 0</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 w ) const</div></li><li><div class=fn>virtual void <a href="#invalidate"><b>invalidate</b></a> ()</div></li><li><div class=fn>virtual QWidget * <a href="#widget"><b>widget</b></a> ()</div></li><li><div class=fn>virtual QLayoutIterator <a href="#iterator"><b>iterator</b></a> ()</div></li><li><div class=fn>virtual QLayout * <a href="#layout"><b>layout</b></a> ()</div></li><li><div class=fn>virtual QSpacerItem * <a href="#spacerItem"><b>spacerItem</b></a> ()</div></li><li><div class=fn>int <a href="#alignment"><b>alignment</b></a> () const</div></li><li><div class=fn>virtual void <a href="#setAlignment"><b>setAlignment</b></a> ( int a )</div></li></ul><hr><a name="details"></a><h2>Detailed Description</h2>The QLayoutItem class provides an abstract item that a<a href="qlayout.html">QLayout</a> manipulates.<p> This is used by custom layouts.<p> Pure virtual functions are provided to return information aboutthe layout, including, <a href="#sizeHint">sizeHint</a>(), <a href="#minimumSize">minimumSize</a>(), <a href="#maximumSize">maximumSize</a>()and <a href="#expanding">expanding</a>().<p> The layout's geometry can be set and retrieved with <a href="#setGeometry">setGeometry</a>()and <a href="#geometry">geometry</a>(), and its alignment with <a href="#setAlignment">setAlignment</a>() and<a href="#alignment">alignment</a>().<p> <a href="#isEmpty">isEmpty</a>() returns whether the layout is empty. <a href="#iterator">iterator</a>() returnsan iterator for the layout's children. If the concrete item is a<a href="qwidget.html">QWidget</a>, it can be retrieved using <a href="#widget">widget</a>(). Similarly for<a href="#layout">layout</a>() and <a href="#spacerItem">spacerItem</a>().<p> <p>See also <a href="qlayout.html">QLayout</a>, <a href="appearance.html">Widget Appearance and Style</a> and <a href="geomanagement.html">Layout Management</a>.<hr><h2>Member Function Documentation</h2><h3 class=fn><a name="QLayoutItem"></a>QLayoutItem::QLayoutItem ( int alignment = 0 )</h3><p> Constructs a layout item with an <em>alignment</em> that is a bitwise ORof the <a href="qt.html#AlignmentFlags-enum">Qt::AlignmentFlags</a>. Not all subclasses supportalignment.<h3 class=fn><a name="~QLayoutItem"></a>QLayoutItem::~QLayoutItem ()<tt> [virtual]</tt></h3>Destroys the QLayoutItem.<h3 class=fn>int <a name="alignment"></a>QLayoutItem::alignment () const</h3><p> Returns the alignment of this item.<h3 class=fn><a href="qsizepolicy.html#ExpandData-enum">QSizePolicy::ExpandData</a> <a name="expanding"></a>QLayoutItem::expanding () const<tt> [pure virtual]</tt></h3><p> Implemented in subclasses to return whether this item "wants" toexpand.<p>Reimplemented in <a href="qlayout.html#expanding">QLayout</a>, <a href="qspaceritem.html#expanding">QSpacerItem</a> and <a href="qwidgetitem.html#expanding">QWidgetItem</a>.<h3 class=fn><a href="qrect.html">QRect</a> <a name="geometry"></a>QLayoutItem::geometry () const<tt> [pure virtual]</tt></h3><p> Returns the rectangle covered by this layout item.<p>Example: <a href="customlayout-example.html#x1366">customlayout/border.cpp</a>.<h3 class=fn>bool <a name="hasHeightForWidth"></a>QLayoutItem::hasHeightForWidth () const<tt> [virtual]</tt></h3>Returns TRUE if this layout's preferred height depends on itswidth; otherwise returns FALSE. The default implementation returnsFALSE.<p> Reimplement this function in layout managers that support heightfor width.<p> <p>See also <a href="#heightForWidth">heightForWidth</a>() and <a href="qwidget.html#heightForWidth">QWidget::heightForWidth</a>().<p>Examples: <a href="customlayout-example.html#x1367">customlayout/border.cpp</a> and <a href="customlayout-example.html#x1343">customlayout/flow.cpp</a>.<p>Reimplemented in <a href="qgridlayout.html#hasHeightForWidth">QGridLayout</a> and <a href="qboxlayout.html#hasHeightForWidth">QBoxLayout</a>.<h3 class=fn>int <a name="heightForWidth"></a>QLayoutItem::heightForWidth ( int w ) const<tt> [virtual]</tt></h3>Returns the preferred height for this layout item, given the width<em>w</em>.<p> The default implementation returns -1, indicating that thepreferred height is independent of the width of the item. Usingthe function <a href="#hasHeightForWidth">hasHeightForWidth</a>() will typically be much fasterthan calling this function and testing for -1.<p> Reimplement this function in layout managers that support heightfor width. A typical implementation will look like this:<pre> int MyLayout::heightForWidth( int w ) const { if ( cache_dirty || cached_width != w ) { // not all C++ compilers support "mutable" MyLayout *that = (MyLayout*)this; int h = calculateHeightForWidth( w ); that->cached_hfw = h; return h; } return cached_hfw; } </pre> <p> Caching is strongly recommended; without it layout will takeexponential time.<p> <p>See also <a href="#hasHeightForWidth">hasHeightForWidth</a>().<p>Example: <a href="customlayout-example.html#x1344">customlayout/flow.cpp</a>.<p>Reimplemented in <a href="qgridlayout.html#heightForWidth">QGridLayout</a> and <a href="qboxlayout.html#heightForWidth">QBoxLayout</a>.<h3 class=fn>void <a name="invalidate"></a>QLayoutItem::invalidate ()<tt> [virtual]</tt></h3>Invalidates any cached information in this layout item.<p>Reimplemented in <a href="qlayout.html#invalidate">QLayout</a>.<h3 class=fn>bool <a name="isEmpty"></a>QLayoutItem::isEmpty () const<tt> [pure virtual]</tt></h3><p> Implemented in subclasses to return whether this item is empty,i.e. whether it contains any widgets.<p>Reimplemented in <a href="qlayout.html#isEmpty">QLayout</a>, <a href="qspaceritem.html#isEmpty">QSpacerItem</a> and <a href="qwidgetitem.html#isEmpty">QWidgetItem</a>.<h3 class=fn><a href="qlayoutiterator.html">QLayoutIterator</a> <a name="iterator"></a>QLayoutItem::iterator ()<tt> [virtual]</tt></h3>Returns an iterator over this item's QLayoutItem children. Thedefault implementation returns an empty iterator.<p> Reimplement this function in subclasses that can have children.<p>Reimplemented in <a href="qlayout.html#iterator">QLayout</a>.<h3 class=fn><a href="qlayout.html">QLayout</a> * <a name="layout"></a>QLayoutItem::layout ()<tt> [virtual]</tt></h3>If this item is a <a href="qlayout.html">QLayout</a>, it is returned as a QLayout; otherwise0 is returned. This function provides type-safe casting.<h3 class=fn><a href="qsize.html">QSize</a> <a name="maximumSize"></a>QLayoutItem::maximumSize () const<tt> [pure virtual]</tt></h3><p> Implemented in subclasses to return the maximum size of this item.<p>Reimplemented in <a href="qlayout.html#maximumSize">QLayout</a>, <a href="qspaceritem.html#maximumSize">QSpacerItem</a> and <a href="qwidgetitem.html#maximumSize">QWidgetItem</a>.<h3 class=fn><a href="qsize.html">QSize</a> <a name="minimumSize"></a>QLayoutItem::minimumSize () const<tt> [pure virtual]</tt></h3><p> Implemented in subclasses to return the minimum size of this item.<p>Examples: <a href="customlayout-example.html#x1368">customlayout/border.cpp</a>, <a href="customlayout-example.html#x1386">customlayout/card.cpp</a> and <a href="customlayout-example.html#x1345">customlayout/flow.cpp</a>.<p>Reimplemented in <a href="qlayout.html#minimumSize">QLayout</a>, <a href="qspaceritem.html#minimumSize">QSpacerItem</a> and <a href="qwidgetitem.html#minimumSize">QWidgetItem</a>.<h3 class=fn>void <a name="setAlignment"></a>QLayoutItem::setAlignment ( int a )<tt> [virtual]</tt></h3>Sets the alignment of this item to <em>a</em>, which is a bitwise OR ofthe <a href="qt.html#AlignmentFlags-enum">Qt::AlignmentFlags</a>. Not all subclasses support alignment.<p>Example: <a href="tutorial2-09.html#x2549">chart/optionsform.cpp</a>.<h3 class=fn>void <a name="setGeometry"></a>QLayoutItem::setGeometry ( const <a href="qrect.html">QRect</a> & r )<tt> [pure virtual]</tt></h3><p> Implemented in subclasses to set this item's geometry to <em>r</em>.<p>Examples: <a href="customlayout-example.html#x1369">customlayout/border.cpp</a>, <a href="customlayout-example.html#x1387">customlayout/card.cpp</a> and <a href="customlayout-example.html#x1346">customlayout/flow.cpp</a>.<p>Reimplemented in <a href="qlayout.html#setGeometry">QLayout</a>, <a href="qspaceritem.html#setGeometry">QSpacerItem</a> and <a href="qwidgetitem.html#setGeometry">QWidgetItem</a>.<h3 class=fn><a href="qsize.html">QSize</a> <a name="sizeHint"></a>QLayoutItem::sizeHint () const<tt> [pure virtual]</tt></h3><p> Implemented in subclasses to return the preferred size of this item.<p>Examples: <a href="customlayout-example.html#x1370">customlayout/border.cpp</a>, <a href="customlayout-example.html#x1388">customlayout/card.cpp</a> and <a href="customlayout-example.html#x1347">customlayout/flow.cpp</a>.<p>Reimplemented in <a href="qspaceritem.html#sizeHint">QSpacerItem</a>, <a href="qwidgetitem.html#sizeHint">QWidgetItem</a>, <a href="qgridlayout.html#sizeHint">QGridLayout</a> and <a href="qboxlayout.html#sizeHint">QBoxLayout</a>.<h3 class=fn><a href="qspaceritem.html">QSpacerItem</a> * <a name="spacerItem"></a>QLayoutItem::spacerItem ()<tt> [virtual]</tt></h3>If this item is a <a href="qspaceritem.html">QSpacerItem</a>, it is returned as a QSpacerItem;otherwise 0 is returned. This function provides type-safe casting.<h3 class=fn><a href="qwidget.html">QWidget</a> * <a name="widget"></a>QLayoutItem::widget ()<tt> [virtual]</tt></h3>If this item is a <a href="qwidget.html">QWidget</a>, it is returned as a QWidget; otherwise0 is returned. This function provides type-safe casting.<p>Reimplemented in <a href="qwidgetitem.html#widget">QWidgetItem</a>.<!-- eof --><hr><p>This file is part of the <a href="index.html">Qt toolkit</a>.Copyright © 1995-2002<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 © 2002 <a href="http://www.trolltech.com">Trolltech</a><td><a href="http://www.trolltech.com/trademarks.html">Trademarks</a><td align=right><div align=right>Qt version 3.0.5</div></table></div></address></body></html>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?