<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <!-- /tmp/qt-3.0-reggie-28534/qt-x11-free-3.0.2/src/kernel/qabstractlayout.cpp:1218 --> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> <title>QSizePolicy 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>QSizePolicy Class Reference</h1> <p>The QSizePolicy class is a layout attribute describing horizontal and vertical resizing. <a href="#details">More...</a> <p><tt>#include <<a href="qsizepolicy-h.html">qsizepolicy.h</a>></tt> <p><a href="qsizepolicy-members.html">List of all member functions.</a> <h2>Public Members</h2> <ul> <li><div class=fn>enum <a href="#SizeType-enum"><b>SizeType</b></a> { Fixed = 0, Minimum = MayGrow, Maximum = MayShrink, Preferred = MayGrow | MayShrink, MinimumExpanding = MayGrow | ExpMask, Expanding = MayGrow | MayShrink | ExpMask, Ignored = ExpMask }</div></li> <li><div class=fn>enum <a href="#ExpandData-enum"><b>ExpandData</b></a> { NoDirection = 0, Horizontally = 1, Vertically = 2, BothDirections = Horizontally | Vertically, Horizontal = Horizontally, Vertical = Vertically }</div></li> <li><div class=fn><a href="#QSizePolicy"><b>QSizePolicy</b></a> ()</div></li> <li><div class=fn><a href="#QSizePolicy-2"><b>QSizePolicy</b></a> ( SizeType hor, SizeType ver, bool hfw = FALSE )</div></li> <li><div class=fn><a href="#QSizePolicy-3"><b>QSizePolicy</b></a> ( SizeType hor, SizeType ver, uchar horStretch, uchar verStretch, bool hfw = FALSE )</div></li> <li><div class=fn>SizeType <a href="#horData"><b>horData</b></a> () const</div></li> <li><div class=fn>SizeType <a href="#verData"><b>verData</b></a> () const</div></li> <li><div class=fn>bool <a href="#mayShrinkHorizontally"><b>mayShrinkHorizontally</b></a> () const</div></li> <li><div class=fn>bool <a href="#mayShrinkVertically"><b>mayShrinkVertically</b></a> () const</div></li> <li><div class=fn>bool <a href="#mayGrowHorizontally"><b>mayGrowHorizontally</b></a> () const</div></li> <li><div class=fn>bool <a href="#mayGrowVertically"><b>mayGrowVertically</b></a> () const</div></li> <li><div class=fn>ExpandData <a href="#expanding"><b>expanding</b></a> () const</div></li> <li><div class=fn>void <a href="#setHorData"><b>setHorData</b></a> ( SizeType d )</div></li> <li><div class=fn>void <a href="#setVerData"><b>setVerData</b></a> ( SizeType d )</div></li> <li><div class=fn>void <a href="#setHeightForWidth"><b>setHeightForWidth</b></a> ( bool b )</div></li> <li><div class=fn>bool <a href="#hasHeightForWidth"><b>hasHeightForWidth</b></a> () const</div></li> <li><div class=fn>bool <a href="#operator-eq-eq"><b>operator==</b></a> ( const QSizePolicy & s ) const</div></li> <li><div class=fn>bool <a href="#operator!-eq"><b>operator!=</b></a> ( const QSizePolicy & s ) const</div></li> <li><div class=fn>uint <a href="#horStretch"><b>horStretch</b></a> () const</div></li> <li><div class=fn>uint <a href="#verStretch"><b>verStretch</b></a> () const</div></li> <li><div class=fn>void <a href="#setHorStretch"><b>setHorStretch</b></a> ( uchar sf )</div></li> <li><div class=fn>void <a href="#setVerStretch"><b>setVerStretch</b></a> ( uchar sf )</div></li> </ul> <hr><a name="details"></a><h2>Detailed Description</h2> The QSizePolicy class is a layout attribute describing horizontal and vertical resizing. <p> The size policy of a widget is an expression of its willingness to be resized in various ways. <p> Widgets that reimplement <a href="qwidget.html#sizePolicy">QWidget::sizePolicy</a>() return a QSizePolicy describing the horizontal and vertical resizing policy best used when laying out the widget. Only <a href="#interesting">one of the constructors</a> is of interest in most applications. <p> QSizePolicy contains two independent SizeType objects; one describes the widgets's horizontal size policy, and the other describes its vertical size policy. It also contains a flag to indicate whether the height and width of its preferred size are related. <p> The per-dimension SizeType objects are set in the usual constructor and can be queried using a variety of functions, none of which are really interesting to application programmers. <p> The <a href="#hasHeightForWidth">hasHeightForWidth</a>() flag indicates whether the widget's sizeHint() is width-dependent (such as a word-wrapping label). <p> <p>See also <a href="#SizeType-enum">QSizePolicy::SizeType</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="ExpandData-enum"></a>QSizePolicy::ExpandData</h3> <p> This enum type describes in which directions a widget can make use of extra space. There are four possible values: <ul> <li><tt>QSizePolicy::NoDirection</tt> - the widget cannot make use of extra space in any direction. <li><tt>QSizePolicy::Horizontally</tt> - the widget can usefully be wider than the sizeHint(). <li><tt>QSizePolicy::Vertically</tt> - the widget can usefully be taller than the sizeHint(). <li><tt>QSizePolicy::BothDirections</tt> - the widget can usefully be both wider and taller than the sizeHint(). </ul><p> <h3 class=fn><a name="SizeType-enum"></a>QSizePolicy::SizeType</h3> <p> The per-dimension sizing types used when constructing a QSizePolicy are: <ul> <li><tt>QSizePolicy::Fixed</tt> - the <a href="qwidget.html#sizeHint">QWidget::sizeHint</a>() is the only acceptable alternative, so the widget can never grow or shrink (e.g. the vertical direction of a push button). <li><tt>QSizePolicy::Minimum</tt> - the sizeHint() is minimal, and sufficient. The widget can be expanded, but there is no advantage to it being larger (e.g. the horizontal direction of a push button). <li><tt>QSizePolicy::Maximum</tt> - the sizeHint() is a maximum. The widget can be shrunk any amount without detriment if other widgets need the space (e.g. a separator line). <li><tt>QSizePolicy::Preferred</tt> - the sizeHint() is best, but the widget can be shrunk and still be useful. The widget can be expanded, but there is no advantage to it being larger than sizeHint() (the default <a href="qwidget.html">QWidget</a> policy). <li><tt>QSizePolicy::Expanding</tt> - the sizeHint() is a sensible size, but the widget can be shrunk and still be useful. The widget can make use of extra space, so it should get as much space as possible (e.g. the horizontal direction of a slider). <li><tt>QSizePolicy::MinimumExpanding</tt> - the sizeHint() is minimal, and sufficient. The widget can make use of extra space, so it should get as much space as possible (e.g. the horizontal direction of a slider). <li><tt>QSizePolicy::Ignored</tt> - the sizeHint() is ignored. The widget will get as much space as possible. </ul><p> In any case, <a href="qlayout.html">QLayout</a> never shrinks a widget below the <a href="qwidget.html#minimumSizeHint">QWidget::minimumSizeHint</a>(). <hr><h2>Member Function Documentation</h2> <h3 class=fn><a name="QSizePolicy"></a>QSizePolicy::QSizePolicy () </h3> <p> Default constructor; produces a minimally initialized QSizePolicy. <h3 class=fn><a name="QSizePolicy-2"></a>QSizePolicy::QSizePolicy ( <a href="qsizepolicy.html#SizeType-enum">SizeType</a> hor, <a href="qsizepolicy.html#SizeType-enum">SizeType</a> ver, bool hfw = FALSE ) </h3> <p> <a name="interesting"></a> This is the constructor normally used to return a value in the overridden <a href="qwidget.html#sizePolicy">QWidget::sizePolicy</a>() function of a <a href="qwidget.html">QWidget</a> subclass. <p> It constructs a QSizePolicy with independent horizontal and vertical sizing types, <em>hor</em> and <em>ver</em> respectively. These <a href="#SizeType-enum">sizing types</a> affect how the widget is treated by the <a href="qlayout.html">layout engine</a>. <p> If <em>hfw</em> is TRUE, the preferred height of the widget is dependent on the width of the widget (for example, a <a href="qlabel.html">QLabel</a> with line wrapping). <p> <p>See also <a href="#horData">horData</a>(), <a href="#verData">verData</a>() and <a href="#hasHeightForWidth">hasHeightForWidth</a>(). <h3 class=fn><a name="QSizePolicy-3"></a>QSizePolicy::QSizePolicy ( <a href="qsizepolicy.html#SizeType-enum">SizeType</a> hor, <a href="qsizepolicy.html#SizeType-enum">SizeType</a> ver, uchar horStretch, uchar verStretch, bool hfw = FALSE ) </h3> <p> Constructs a QSizePolicy with independent horizontal and vertical sizing types <em>hor</em> and <em>ver</em>, and stretch factors <em>horStretch</em> and <em>verStretch</em>. <p> If <em>hfw</em> is TRUE, the preferred height of the widget is dependent on the width of the widget. <p> <p>See also <a href="#horStretch">horStretch</a>() and <a href="#verStretch">verStretch</a>(). <h3 class=fn><a href="qsizepolicy.html#ExpandData-enum">ExpandData</a> <a name="expanding"></a>QSizePolicy::expanding () const </h3> Returns a value indicating whether the widget can make use of extra space (i.e. if it "wants" to grow) horizontally and/or vertically. <p> <p>See also <a href="#mayShrinkHorizontally">mayShrinkHorizontally</a>(), <a href="#mayGrowHorizontally">mayGrowHorizontally</a>(), <a href="#mayShrinkVertically">mayShrinkVertically</a>() and <a href="#mayGrowVertically">mayGrowVertically</a>(). <h3 class=fn>bool <a name="hasHeightForWidth"></a>QSizePolicy::hasHeightForWidth () const </h3> Returns TRUE if the widget's preferred height depends on its width; otherwise returns FALSE. <p> <p>See also <a href="#setHeightForWidth">setHeightForWidth</a>(). <h3 class=fn><a href="qsizepolicy.html#SizeType-enum">SizeType</a> <a name="horData"></a>QSizePolicy::horData () const </h3> Returns the horizontal component of the size policy. <p> <p>See also <a href="#setHorData">setHorData</a>(), <a href="#verData">verData</a>() and <a href="#horStretch">horStretch</a>(). <h3 class=fn>uint <a name="horStretch"></a>QSizePolicy::horStretch () const </h3> Returns the horizontal <a href="layout.html#stretch-factor">stretch factor</a> of the size policy. <p> <p>See also <a href="#setHorStretch">setHorStretch</a>() and <a href="#verStretch">verStretch</a>(). <h3 class=fn>bool <a name="mayGrowHorizontally"></a>QSizePolicy::mayGrowHorizontally () const </h3> Returns TRUE if the widget can sensibly be wider than its sizeHint(); otherwise returns FALSE. <p> <p>See also <a href="#mayGrowVertically">mayGrowVertically</a>() and <a href="#mayShrinkHorizontally">mayShrinkHorizontally</a>(). <h3 class=fn>bool <a name="mayGrowVertically"></a>QSizePolicy::mayGrowVertically () const </h3> Returns TRUE if the widget can sensibly be taller than its sizeHint(); otherwise returns FALSE. <p> <p>See also <a href="#mayGrowHorizontally">mayGrowHorizontally</a>() and <a href="#mayShrinkVertically">mayShrinkVertically</a>(). <h3 class=fn>bool <a name="mayShrinkHorizontally"></a>QSizePolicy::mayShrinkHorizontally () const </h3> Returns TRUE if the widget can sensibly be narrower than its sizeHint(); otherwise returns FALSE. <p> <p>See also <a href="#mayShrinkVertically">mayShrinkVertically</a>() and <a href="#mayGrowHorizontally">mayGrowHorizontally</a>(). <h3 class=fn>bool <a name="mayShrinkVertically"></a>QSizePolicy::mayShrinkVertically () const </h3> Returns TRUE if the widget can sensibly be shorter than its sizeHint(); otherwise returns FALSE. <p> <p>See also <a href="#mayShrinkHorizontally">mayShrinkHorizontally</a>() and <a href="#mayGrowVertically">mayGrowVertically</a>(). <h3 class=fn>bool <a name="operator!-eq"></a>QSizePolicy::operator!= ( const <a href="qsizepolicy.html">QSizePolicy</a> & s ) const </h3> Returns TRUE if this policy is different from <em>s</em>; otherwise returns FALSE. <p> <p>See also <a href="#operator-eq-eq">operator==</a>(). <h3 class=fn>bool <a name="operator-eq-eq"></a>QSizePolicy::operator== ( const <a href="qsizepolicy.html">QSizePolicy</a> & s ) const </h3> Returns TRUE if this policy is equal to <em>s</em>; otherwise returns FALSE. <p> <p>See also <a href="#operator!-eq">operator!=</a>(). <h3 class=fn>void <a name="setHeightForWidth"></a>QSizePolicy::setHeightForWidth ( bool b ) </h3> Sets the <a href="#hasHeightForWidth">hasHeightForWidth</a>() flag to <em>b</em>. <p> <p>See also <a href="#hasHeightForWidth">hasHeightForWidth</a>(). <h3 class=fn>void <a name="setHorData"></a>QSizePolicy::setHorData ( <a href="qsizepolicy.html#SizeType-enum">SizeType</a> d ) </h3> Sets the horizontal component of the size policy to size type <em>d</em>. <p> <p>See also <a href="#horData">horData</a>() and <a href="#setVerData">setVerData</a>(). <h3 class=fn>void <a name="setHorStretch"></a>QSizePolicy::setHorStretch ( uchar sf ) </h3> Sets the horizontal <a href="layout.html#stretch-factor">stretch factor</a> of the size policy to <em>sf</em>. <p> <p>See also <a href="#horStretch">horStretch</a>() and <a href="#setVerStretch">setVerStretch</a>(). <h3 class=fn>void <a name="setVerData"></a>QSizePolicy::setVerData ( <a href="qsizepolicy.html#SizeType-enum">SizeType</a> d ) </h3> Sets the vertical component of the size policy to size type <em>d</em>. <p> <p>See also <a href="#verData">verData</a>() and <a href="#setHorData">setHorData</a>(). <h3 class=fn>void <a name="setVerStretch"></a>QSizePolicy::setVerStretch ( uchar sf ) </h3> Sets the vertical <a href="layout.html#stretch-factor">stretch factor</a> of the size policy to <em>sf</em>. <p> <p>See also <a href="#verStretch">verStretch</a>() and <a href="#setHorStretch">setHorStretch</a>(). <h3 class=fn><a href="qsizepolicy.html#SizeType-enum">SizeType</a> <a name="verData"></a>QSizePolicy::verData () const </h3> Returns the vertical component of the size policy. <p> <p>See also <a href="#setVerData">setVerData</a>(), <a href="#horData">horData</a>() and <a href="#verStretch">verStretch</a>(). <h3 class=fn>uint <a name="verStretch"></a>QSizePolicy::verStretch () const </h3> Returns the vertical <a href="layout.html#stretch-factor">stretch factor</a> of the size policy. <p> <p>See also <a href="#setVerStretch">setVerStretch</a>() and <a href="#horStretch">horStretch</a>(). <!-- eof --> <hr><p> This file is part of the <a href="index.html">Qt toolkit</a>. Copyright © 1995-2001 <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 © 2001 <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.2</div> </table></div></address></body> </html>