1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- /home/harald/tmp/qt-3.3.7-harald-4508/qt-x11-free-3.3.7/src/kernel/qabstractlayout.cpp:1234 -->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>QSizePolicy 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>QSizePolicy Class Reference</h1>
<p>The QSizePolicy class is a layout attribute describing horizontal
and vertical resizing policy.
<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 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 }</li>
<li class=fn>enum <a href="#ExpandData-enum"><b>ExpandData</b></a> { NoDirection = 0, Horizontally = 1, Vertically = 2, Horizontal = Horizontally, Vertical = Vertically, BothDirections = Horizontally | Vertically }</li>
<li class=fn><a href="#QSizePolicy"><b>QSizePolicy</b></a> ()</li>
<li class=fn><a href="#QSizePolicy-2"><b>QSizePolicy</b></a> ( SizeType hor, SizeType ver, bool hfw = FALSE )</li>
<li class=fn><a href="#QSizePolicy-3"><b>QSizePolicy</b></a> ( SizeType hor, SizeType ver, uchar horStretch, uchar verStretch, bool hfw = FALSE )</li>
<li class=fn>SizeType <a href="#horData"><b>horData</b></a> () const</li>
<li class=fn>SizeType <a href="#verData"><b>verData</b></a> () const</li>
<li class=fn>bool <a href="#mayShrinkHorizontally"><b>mayShrinkHorizontally</b></a> () const</li>
<li class=fn>bool <a href="#mayShrinkVertically"><b>mayShrinkVertically</b></a> () const</li>
<li class=fn>bool <a href="#mayGrowHorizontally"><b>mayGrowHorizontally</b></a> () const</li>
<li class=fn>bool <a href="#mayGrowVertically"><b>mayGrowVertically</b></a> () const</li>
<li class=fn>ExpandData <a href="#expanding"><b>expanding</b></a> () const</li>
<li class=fn>void <a href="#setHorData"><b>setHorData</b></a> ( SizeType d )</li>
<li class=fn>void <a href="#setVerData"><b>setVerData</b></a> ( SizeType d )</li>
<li class=fn>void <a href="#setHeightForWidth"><b>setHeightForWidth</b></a> ( bool b )</li>
<li class=fn>bool <a href="#hasHeightForWidth"><b>hasHeightForWidth</b></a> () const</li>
<li class=fn>bool <a href="#operator-eq-eq"><b>operator==</b></a> ( const QSizePolicy & s ) const</li>
<li class=fn>bool <a href="#operator!-eq"><b>operator!=</b></a> ( const QSizePolicy & s ) const</li>
<li class=fn>uint <a href="#horStretch"><b>horStretch</b></a> () const</li>
<li class=fn>uint <a href="#verStretch"><b>verStretch</b></a> () const</li>
<li class=fn>void <a href="#setHorStretch"><b>setHorStretch</b></a> ( uchar sf )</li>
<li class=fn>void <a href="#setVerStretch"><b>setVerStretch</b></a> ( uchar sf )</li>
<li class=fn>void <a href="#transpose"><b>transpose</b></a> ()</li>
</ul>
<hr><a name="details"></a><h2>Detailed Description</h2>
The QSizePolicy class is a layout attribute describing horizontal
and vertical resizing policy.
<p>
<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
that describes the horizontal and vertical resizing policy they
prefer when being laid out. 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 horizontal and vertical <a href="#SizeType-enum">SizeType</a>s are set in the usual constructor
and can be queried using a variety of functions.
<p> The <a href="#hasHeightForWidth">hasHeightForWidth</a>() flag indicates whether the widget's sizeHint()
is width-dependent (such as a word-wrapping label) or not.
<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>
<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).
It cannot be smaller than the size provided by sizeHint().
<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).
It cannot be larger than the size provided by sizeHint().
<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>
<hr><h2>Member Function Documentation</h2>
<h3 class=fn><a name="QSizePolicy"></a>QSizePolicy::QSizePolicy ()
</h3>
<p> Constructs 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>
<p> Returns whether this layout can make use of more space than
sizeHint(). A value of <a href="#ExpandData-enum">Vertical</a> or <a href="#ExpandData-enum">Horizontal</a> means that it wants
to grow in only one dimension, whereas <a href="#ExpandData-enum">BothDirections</a> means that
it wants to grow in both dimensions.
<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>
<p> 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>
<p> 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>
<p> 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>
<p> 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>
<p> 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>
<p> 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>
<p> 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>
<p> 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>
<p> 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>
<p> 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>
<p> 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>
<p> 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>
<p> 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>
<p> 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>void <a name="transpose"></a>QSizePolicy::transpose ()
</h3>
<p> Swaps the horizontal and vertical policies and stretches.
<h3 class=fn><a href="qsizepolicy.html#SizeType-enum">SizeType</a> <a name="verData"></a>QSizePolicy::verData () const
</h3>
<p> 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>
<p> 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-2005
<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 © 2005
<a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
<td align=right><div align=right>Qt 3.3.7</div>
</table></div></address></body>
</html>
|