1 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
---|
2 | <!-- /home/espenr/tmp/qt-3.3.8-espenr-2499/qt-x11-free-3.3.8/src/kernel/qabstractlayout.cpp:1240 -->
|
---|
3 | <html>
|
---|
4 | <head>
|
---|
5 | <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
---|
6 | <title>QSizePolicy Class</title>
|
---|
7 | <style type="text/css"><!--
|
---|
8 | fn { margin-left: 1cm; text-indent: -1cm; }
|
---|
9 | a:link { color: #004faf; text-decoration: none }
|
---|
10 | a:visited { color: #672967; text-decoration: none }
|
---|
11 | body { background: #ffffff; color: black; }
|
---|
12 | --></style>
|
---|
13 | </head>
|
---|
14 | <body>
|
---|
15 |
|
---|
16 | <table border="0" cellpadding="0" cellspacing="0" width="100%">
|
---|
17 | <tr bgcolor="#E5E5E5">
|
---|
18 | <td valign=center>
|
---|
19 | <a href="index.html">
|
---|
20 | <font color="#004faf">Home</font></a>
|
---|
21 | | <a href="classes.html">
|
---|
22 | <font color="#004faf">All Classes</font></a>
|
---|
23 | | <a href="mainclasses.html">
|
---|
24 | <font color="#004faf">Main Classes</font></a>
|
---|
25 | | <a href="annotated.html">
|
---|
26 | <font color="#004faf">Annotated</font></a>
|
---|
27 | | <a href="groups.html">
|
---|
28 | <font color="#004faf">Grouped Classes</font></a>
|
---|
29 | | <a href="functions.html">
|
---|
30 | <font color="#004faf">Functions</font></a>
|
---|
31 | </td>
|
---|
32 | <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>
|
---|
33 |
|
---|
34 | <p>The QSizePolicy class is a layout attribute describing horizontal
|
---|
35 | and vertical resizing policy.
|
---|
36 | <a href="#details">More...</a>
|
---|
37 | <p><tt>#include <<a href="qsizepolicy-h.html">qsizepolicy.h</a>></tt>
|
---|
38 | <p><a href="qsizepolicy-members.html">List of all member functions.</a>
|
---|
39 | <h2>Public Members</h2>
|
---|
40 | <ul>
|
---|
41 | <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>
|
---|
42 | <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>
|
---|
43 | <li class=fn><a href="#QSizePolicy"><b>QSizePolicy</b></a> ()</li>
|
---|
44 | <li class=fn><a href="#QSizePolicy-2"><b>QSizePolicy</b></a> ( SizeType hor, SizeType ver, bool hfw = FALSE )</li>
|
---|
45 | <li class=fn><a href="#QSizePolicy-3"><b>QSizePolicy</b></a> ( SizeType hor, SizeType ver, uchar horStretch, uchar verStretch, bool hfw = FALSE )</li>
|
---|
46 | <li class=fn>SizeType <a href="#horData"><b>horData</b></a> () const</li>
|
---|
47 | <li class=fn>SizeType <a href="#verData"><b>verData</b></a> () const</li>
|
---|
48 | <li class=fn>bool <a href="#mayShrinkHorizontally"><b>mayShrinkHorizontally</b></a> () const</li>
|
---|
49 | <li class=fn>bool <a href="#mayShrinkVertically"><b>mayShrinkVertically</b></a> () const</li>
|
---|
50 | <li class=fn>bool <a href="#mayGrowHorizontally"><b>mayGrowHorizontally</b></a> () const</li>
|
---|
51 | <li class=fn>bool <a href="#mayGrowVertically"><b>mayGrowVertically</b></a> () const</li>
|
---|
52 | <li class=fn>ExpandData <a href="#expanding"><b>expanding</b></a> () const</li>
|
---|
53 | <li class=fn>void <a href="#setHorData"><b>setHorData</b></a> ( SizeType d )</li>
|
---|
54 | <li class=fn>void <a href="#setVerData"><b>setVerData</b></a> ( SizeType d )</li>
|
---|
55 | <li class=fn>void <a href="#setHeightForWidth"><b>setHeightForWidth</b></a> ( bool b )</li>
|
---|
56 | <li class=fn>bool <a href="#hasHeightForWidth"><b>hasHeightForWidth</b></a> () const</li>
|
---|
57 | <li class=fn>bool <a href="#operator-eq-eq"><b>operator==</b></a> ( const QSizePolicy & s ) const</li>
|
---|
58 | <li class=fn>bool <a href="#operator!-eq"><b>operator!=</b></a> ( const QSizePolicy & s ) const</li>
|
---|
59 | <li class=fn>uint <a href="#horStretch"><b>horStretch</b></a> () const</li>
|
---|
60 | <li class=fn>uint <a href="#verStretch"><b>verStretch</b></a> () const</li>
|
---|
61 | <li class=fn>void <a href="#setHorStretch"><b>setHorStretch</b></a> ( uchar sf )</li>
|
---|
62 | <li class=fn>void <a href="#setVerStretch"><b>setVerStretch</b></a> ( uchar sf )</li>
|
---|
63 | <li class=fn>void <a href="#transpose"><b>transpose</b></a> ()</li>
|
---|
64 | </ul>
|
---|
65 | <hr><a name="details"></a><h2>Detailed Description</h2>
|
---|
66 |
|
---|
67 |
|
---|
68 | The QSizePolicy class is a layout attribute describing horizontal
|
---|
69 | and vertical resizing policy.
|
---|
70 | <p>
|
---|
71 |
|
---|
72 | <p> The size policy of a widget is an expression of its willingness to
|
---|
73 | be resized in various ways.
|
---|
74 | <p> Widgets that reimplement <a href="qwidget.html#sizePolicy">QWidget::sizePolicy</a>() return a QSizePolicy
|
---|
75 | that describes the horizontal and vertical resizing policy they
|
---|
76 | prefer when being laid out. Only <a href="#interesting">one of the
|
---|
77 | constructors</a> is of interest in most applications.
|
---|
78 | <p> QSizePolicy contains two independent SizeType objects; one describes
|
---|
79 | the widgets's horizontal size policy, and the other describes its
|
---|
80 | vertical size policy. It also contains a flag to indicate whether the
|
---|
81 | height and width of its preferred size are related.
|
---|
82 | <p> The horizontal and vertical <a href="#SizeType-enum">SizeType</a>s are set in the usual constructor
|
---|
83 | and can be queried using a variety of functions.
|
---|
84 | <p> The <a href="#hasHeightForWidth">hasHeightForWidth</a>() flag indicates whether the widget's sizeHint()
|
---|
85 | is width-dependent (such as a word-wrapping label) or not.
|
---|
86 | <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>.
|
---|
87 |
|
---|
88 | <hr><h2>Member Type Documentation</h2>
|
---|
89 | <h3 class=fn><a name="ExpandData-enum"></a>QSizePolicy::ExpandData</h3>
|
---|
90 |
|
---|
91 | <p> This enum type describes in which directions a widget can make use
|
---|
92 | of extra space. There are four possible values:
|
---|
93 | <ul>
|
---|
94 | <li><tt>QSizePolicy::NoDirection</tt> - the widget cannot make use of extra space in
|
---|
95 | any direction.
|
---|
96 | <li><tt>QSizePolicy::Horizontally</tt> - the widget can usefully be wider than the
|
---|
97 | sizeHint().
|
---|
98 | <li><tt>QSizePolicy::Vertically</tt> - the widget can usefully be taller than the
|
---|
99 | sizeHint().
|
---|
100 | <li><tt>QSizePolicy::BothDirections</tt> - the widget can usefully be both wider and
|
---|
101 | taller than the sizeHint().
|
---|
102 | </ul>
|
---|
103 | <h3 class=fn><a name="SizeType-enum"></a>QSizePolicy::SizeType</h3>
|
---|
104 |
|
---|
105 | <p> The per-dimension sizing types used when constructing a
|
---|
106 | QSizePolicy are:
|
---|
107 | <ul>
|
---|
108 | <li><tt>QSizePolicy::Fixed</tt> - The <a href="qwidget.html#sizeHint">QWidget::sizeHint</a>() is the only acceptable
|
---|
109 | alternative, so the widget can never grow or shrink (e.g. the
|
---|
110 | vertical direction of a push button).
|
---|
111 | <li><tt>QSizePolicy::Minimum</tt> - The sizeHint() is minimal, and sufficient. The
|
---|
112 | widget can be expanded, but there is no advantage to it being
|
---|
113 | larger (e.g. the horizontal direction of a push button).
|
---|
114 | It cannot be smaller than the size provided by sizeHint().
|
---|
115 | <li><tt>QSizePolicy::Maximum</tt> - The sizeHint() is a maximum. The widget can be
|
---|
116 | shrunk any amount without detriment if other widgets need the
|
---|
117 | space (e.g. a separator line).
|
---|
118 | It cannot be larger than the size provided by sizeHint().
|
---|
119 | <li><tt>QSizePolicy::Preferred</tt> - The sizeHint() is best, but the widget can be
|
---|
120 | shrunk and still be useful. The widget can be expanded, but there
|
---|
121 | is no advantage to it being larger than sizeHint() (the default
|
---|
122 | <a href="qwidget.html">QWidget</a> policy).
|
---|
123 | <li><tt>QSizePolicy::Expanding</tt> - The sizeHint() is a sensible size, but the
|
---|
124 | widget can be shrunk and still be useful. The widget can make use
|
---|
125 | of extra space, so it should get as much space as possible (e.g.
|
---|
126 | the horizontal direction of a slider).
|
---|
127 | <li><tt>QSizePolicy::MinimumExpanding</tt> - The sizeHint() is minimal, and sufficient.
|
---|
128 | The widget can make use of extra space, so it should get as much
|
---|
129 | space as possible (e.g. the horizontal direction of a slider).
|
---|
130 | <li><tt>QSizePolicy::Ignored</tt> - the sizeHint() is ignored. The widget will get as
|
---|
131 | much space as possible.
|
---|
132 | </ul>
|
---|
133 | <hr><h2>Member Function Documentation</h2>
|
---|
134 | <h3 class=fn><a name="QSizePolicy"></a>QSizePolicy::QSizePolicy ()
|
---|
135 | </h3>
|
---|
136 |
|
---|
137 | <p> Constructs a minimally initialized QSizePolicy.
|
---|
138 |
|
---|
139 | <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 )
|
---|
140 | </h3>
|
---|
141 |
|
---|
142 | <p> <a name="interesting"></a>
|
---|
143 | This is the constructor normally used to return a value in the
|
---|
144 | overridden <a href="qwidget.html#sizePolicy">QWidget::sizePolicy</a>() function of a <a href="qwidget.html">QWidget</a>
|
---|
145 | subclass.
|
---|
146 | <p> It constructs a QSizePolicy with independent horizontal and
|
---|
147 | vertical sizing types, <em>hor</em> and <em>ver</em> respectively. These <a href="#SizeType-enum">sizing types</a> affect how the widget
|
---|
148 | is treated by the <a href="qlayout.html">layout engine</a>.
|
---|
149 | <p> If <em>hfw</em> is TRUE, the preferred height of the widget is dependent
|
---|
150 | on the width of the widget (for example, a <a href="qlabel.html">QLabel</a> with line
|
---|
151 | wrapping).
|
---|
152 | <p> <p>See also <a href="#horData">horData</a>(), <a href="#verData">verData</a>(), and <a href="#hasHeightForWidth">hasHeightForWidth</a>().
|
---|
153 |
|
---|
154 | <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 )
|
---|
155 | </h3>
|
---|
156 |
|
---|
157 | <p> Constructs a QSizePolicy with independent horizontal and vertical
|
---|
158 | sizing types <em>hor</em> and <em>ver</em>, and stretch factors <em>horStretch</em>
|
---|
159 | and <em>verStretch</em>.
|
---|
160 | <p> If <em>hfw</em> is TRUE, the preferred height of the widget is dependent on the
|
---|
161 | width of the widget.
|
---|
162 | <p> <p>See also <a href="#horStretch">horStretch</a>() and <a href="#verStretch">verStretch</a>().
|
---|
163 |
|
---|
164 | <h3 class=fn><a href="qsizepolicy.html#ExpandData-enum">ExpandData</a> <a name="expanding"></a>QSizePolicy::expanding () const
|
---|
165 | </h3>
|
---|
166 |
|
---|
167 | <p> Returns whether this layout can make use of more space than
|
---|
168 | sizeHint(). A value of <a href="#ExpandData-enum">Vertical</a> or <a href="#ExpandData-enum">Horizontal</a> means that it wants
|
---|
169 | to grow in only one dimension, whereas <a href="#ExpandData-enum">BothDirections</a> means that
|
---|
170 | it wants to grow in both dimensions.
|
---|
171 | <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>().
|
---|
172 |
|
---|
173 | <h3 class=fn>bool <a name="hasHeightForWidth"></a>QSizePolicy::hasHeightForWidth () const
|
---|
174 | </h3>
|
---|
175 |
|
---|
176 | <p> Returns TRUE if the widget's preferred height depends on its
|
---|
177 | width; otherwise returns FALSE.
|
---|
178 | <p> <p>See also <a href="#setHeightForWidth">setHeightForWidth</a>().
|
---|
179 |
|
---|
180 | <h3 class=fn><a href="qsizepolicy.html#SizeType-enum">SizeType</a> <a name="horData"></a>QSizePolicy::horData () const
|
---|
181 | </h3>
|
---|
182 |
|
---|
183 | <p> Returns the horizontal component of the size policy.
|
---|
184 | <p> <p>See also <a href="#setHorData">setHorData</a>(), <a href="#verData">verData</a>(), and <a href="#horStretch">horStretch</a>().
|
---|
185 |
|
---|
186 | <h3 class=fn>uint <a name="horStretch"></a>QSizePolicy::horStretch () const
|
---|
187 | </h3>
|
---|
188 |
|
---|
189 | <p> Returns the horizontal <a href="layout.html#stretch-factor">stretch factor</a> of the size policy.
|
---|
190 | <p> <p>See also <a href="#setHorStretch">setHorStretch</a>() and <a href="#verStretch">verStretch</a>().
|
---|
191 |
|
---|
192 | <h3 class=fn>bool <a name="mayGrowHorizontally"></a>QSizePolicy::mayGrowHorizontally () const
|
---|
193 | </h3>
|
---|
194 |
|
---|
195 | <p> Returns TRUE if the widget can sensibly be wider than its
|
---|
196 | sizeHint(); otherwise returns FALSE.
|
---|
197 | <p> <p>See also <a href="#mayGrowVertically">mayGrowVertically</a>() and <a href="#mayShrinkHorizontally">mayShrinkHorizontally</a>().
|
---|
198 |
|
---|
199 | <h3 class=fn>bool <a name="mayGrowVertically"></a>QSizePolicy::mayGrowVertically () const
|
---|
200 | </h3>
|
---|
201 |
|
---|
202 | <p> Returns TRUE if the widget can sensibly be taller than its
|
---|
203 | sizeHint(); otherwise returns FALSE.
|
---|
204 | <p> <p>See also <a href="#mayGrowHorizontally">mayGrowHorizontally</a>() and <a href="#mayShrinkVertically">mayShrinkVertically</a>().
|
---|
205 |
|
---|
206 | <h3 class=fn>bool <a name="mayShrinkHorizontally"></a>QSizePolicy::mayShrinkHorizontally () const
|
---|
207 | </h3>
|
---|
208 |
|
---|
209 | <p> Returns TRUE if the widget can sensibly be narrower than its
|
---|
210 | sizeHint(); otherwise returns FALSE.
|
---|
211 | <p> <p>See also <a href="#mayShrinkVertically">mayShrinkVertically</a>() and <a href="#mayGrowHorizontally">mayGrowHorizontally</a>().
|
---|
212 |
|
---|
213 | <h3 class=fn>bool <a name="mayShrinkVertically"></a>QSizePolicy::mayShrinkVertically () const
|
---|
214 | </h3>
|
---|
215 |
|
---|
216 | <p> Returns TRUE if the widget can sensibly be shorter than its
|
---|
217 | sizeHint(); otherwise returns FALSE.
|
---|
218 | <p> <p>See also <a href="#mayShrinkHorizontally">mayShrinkHorizontally</a>() and <a href="#mayGrowVertically">mayGrowVertically</a>().
|
---|
219 |
|
---|
220 | <h3 class=fn>bool <a name="operator!-eq"></a>QSizePolicy::operator!= ( const <a href="qsizepolicy.html">QSizePolicy</a> & s ) const
|
---|
221 | </h3>
|
---|
222 |
|
---|
223 | <p> Returns TRUE if this policy is different from <em>s</em>; otherwise
|
---|
224 | returns FALSE.
|
---|
225 | <p> <p>See also <a href="#operator-eq-eq">operator==</a>().
|
---|
226 |
|
---|
227 | <h3 class=fn>bool <a name="operator-eq-eq"></a>QSizePolicy::operator== ( const <a href="qsizepolicy.html">QSizePolicy</a> & s ) const
|
---|
228 | </h3>
|
---|
229 |
|
---|
230 | <p> Returns TRUE if this policy is equal to <em>s</em>; otherwise returns
|
---|
231 | FALSE.
|
---|
232 | <p> <p>See also <a href="#operator!-eq">operator!=</a>().
|
---|
233 |
|
---|
234 | <h3 class=fn>void <a name="setHeightForWidth"></a>QSizePolicy::setHeightForWidth ( bool b )
|
---|
235 | </h3>
|
---|
236 |
|
---|
237 | <p> Sets the <a href="#hasHeightForWidth">hasHeightForWidth</a>() flag to <em>b</em>.
|
---|
238 | <p> <p>See also <a href="#hasHeightForWidth">hasHeightForWidth</a>().
|
---|
239 |
|
---|
240 | <h3 class=fn>void <a name="setHorData"></a>QSizePolicy::setHorData ( <a href="qsizepolicy.html#SizeType-enum">SizeType</a> d )
|
---|
241 | </h3>
|
---|
242 |
|
---|
243 | <p> Sets the horizontal component of the size policy to size type <em>d</em>.
|
---|
244 | <p> <p>See also <a href="#horData">horData</a>() and <a href="#setVerData">setVerData</a>().
|
---|
245 |
|
---|
246 | <h3 class=fn>void <a name="setHorStretch"></a>QSizePolicy::setHorStretch ( uchar sf )
|
---|
247 | </h3>
|
---|
248 |
|
---|
249 | <p> Sets the horizontal <a href="layout.html#stretch-factor">stretch factor</a> of the size policy to <em>sf</em>.
|
---|
250 | <p> <p>See also <a href="#horStretch">horStretch</a>() and <a href="#setVerStretch">setVerStretch</a>().
|
---|
251 |
|
---|
252 | <h3 class=fn>void <a name="setVerData"></a>QSizePolicy::setVerData ( <a href="qsizepolicy.html#SizeType-enum">SizeType</a> d )
|
---|
253 | </h3>
|
---|
254 |
|
---|
255 | <p> Sets the vertical component of the size policy to size type <em>d</em>.
|
---|
256 | <p> <p>See also <a href="#verData">verData</a>() and <a href="#setHorData">setHorData</a>().
|
---|
257 |
|
---|
258 | <h3 class=fn>void <a name="setVerStretch"></a>QSizePolicy::setVerStretch ( uchar sf )
|
---|
259 | </h3>
|
---|
260 |
|
---|
261 | <p> Sets the vertical <a href="layout.html#stretch-factor">stretch factor</a> of the size policy to <em>sf</em>.
|
---|
262 | <p> <p>See also <a href="#verStretch">verStretch</a>() and <a href="#setHorStretch">setHorStretch</a>().
|
---|
263 |
|
---|
264 | <h3 class=fn>void <a name="transpose"></a>QSizePolicy::transpose ()
|
---|
265 | </h3>
|
---|
266 |
|
---|
267 | <p> Swaps the horizontal and vertical policies and stretches.
|
---|
268 |
|
---|
269 | <h3 class=fn><a href="qsizepolicy.html#SizeType-enum">SizeType</a> <a name="verData"></a>QSizePolicy::verData () const
|
---|
270 | </h3>
|
---|
271 |
|
---|
272 | <p> Returns the vertical component of the size policy.
|
---|
273 | <p> <p>See also <a href="#setVerData">setVerData</a>(), <a href="#horData">horData</a>(), and <a href="#verStretch">verStretch</a>().
|
---|
274 |
|
---|
275 | <h3 class=fn>uint <a name="verStretch"></a>QSizePolicy::verStretch () const
|
---|
276 | </h3>
|
---|
277 |
|
---|
278 | <p> Returns the vertical <a href="layout.html#stretch-factor">stretch factor</a> of the size policy.
|
---|
279 | <p> <p>See also <a href="#setVerStretch">setVerStretch</a>() and <a href="#horStretch">horStretch</a>().
|
---|
280 |
|
---|
281 | <!-- eof -->
|
---|
282 | <hr><p>
|
---|
283 | This file is part of the <a href="index.html">Qt toolkit</a>.
|
---|
284 | Copyright © 1995-2007
|
---|
285 | <a href="http://www.trolltech.com/">Trolltech</a>. All Rights Reserved.<p><address><hr><div align=center>
|
---|
286 | <table width=100% cellspacing=0 border=0><tr>
|
---|
287 | <td>Copyright © 2007
|
---|
288 | <a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
|
---|
289 | <td align=right><div align=right>Qt 3.3.8</div>
|
---|
290 | </table></div></address></body>
|
---|
291 | </html>
|
---|