1QSizePolicy(3qt) QSizePolicy(3qt)
2
3
4
6 QSizePolicy - Layout attribute describing horizontal and vertical
7 resizing policy
8
10 #include <qsizepolicy.h>
11
12 Public Members
13 enum SizeType { Fixed = 0, Minimum = MayGrow, Maximum = MayShrink,
14 Preferred = MayGrow | MayShrink, MinimumExpanding = MayGrow |
15 ExpMask, Expanding = MayGrow | MayShrink | ExpMask, Ignored =
16 ExpMask }
17 enum ExpandData { NoDirection = 0, Horizontally = 1, Vertically = 2,
18 Horizontal = Horizontally, Vertical = Vertically, BothDirections =
19 Horizontally | Vertically }
20 QSizePolicy ()
21 QSizePolicy ( SizeType hor, SizeType ver, bool hfw = FALSE )
22 QSizePolicy ( SizeType hor, SizeType ver, uchar horStretch, uchar
23 verStretch, bool hfw = FALSE )
24 SizeType horData () const
25 SizeType verData () const
26 bool mayShrinkHorizontally () const
27 bool mayShrinkVertically () const
28 bool mayGrowHorizontally () const
29 bool mayGrowVertically () const
30 ExpandData expanding () const
31 void setHorData ( SizeType d )
32 void setVerData ( SizeType d )
33 void setHeightForWidth ( bool b )
34 bool hasHeightForWidth () const
35 bool operator== ( const QSizePolicy & s ) const
36 bool operator!= ( const QSizePolicy & s ) const
37 uint horStretch () const
38 uint verStretch () const
39 void setHorStretch ( uchar sf )
40 void setVerStretch ( uchar sf )
41 void transpose ()
42
44 The QSizePolicy class is a layout attribute describing horizontal and
45 vertical resizing policy.
46
47 The size policy of a widget is an expression of its willingness to be
48 resized in various ways.
49
50 Widgets that reimplement QWidget::sizePolicy() return a QSizePolicy
51 that describes the horizontal and vertical resizing policy they prefer
52 when being laid out. Only one of the constructors is of interest in
53 most applications.
54
55 QSizePolicy contains two independent SizeType objects; one describes
56 the widgets's horizontal size policy, and the other describes its
57 vertical size policy. It also contains a flag to indicate whether the
58 height and width of its preferred size are related.
59
60 The horizontal and vertical SizeTypes are set in the usual constructor
61 and can be queried using a variety of functions.
62
63 The hasHeightForWidth() flag indicates whether the widget's sizeHint()
64 is width-dependent (such as a word-wrapping label) or not.
65
66 See also QSizePolicy::SizeType, Widget Appearance and Style, and Layout
67 Management.
68
69 Member Type Documentation
71 This enum type describes in which directions a widget can make use of
72 extra space. There are four possible values:
73
74 QSizePolicy::NoDirection - the widget cannot make use of extra space in
75 any direction.
76
77 QSizePolicy::Horizontally - the widget can usefully be wider than the
78 sizeHint().
79
80 QSizePolicy::Vertically - the widget can usefully be taller than the
81 sizeHint().
82
83 QSizePolicy::BothDirections - the widget can usefully be both wider and
84 taller than the sizeHint().
85
87 The per-dimension sizing types used when constructing a QSizePolicy
88 are:
89
90 QSizePolicy::Fixed - The QWidget::sizeHint() is the only acceptable
91 alternative, so the widget can never grow or shrink (e.g. the vertical
92 direction of a push button).
93
94 QSizePolicy::Minimum - The sizeHint() is minimal, and sufficient. The
95 widget can be expanded, but there is no advantage to it being larger
96 (e.g. the horizontal direction of a push button). It cannot be smaller
97 than the size provided by sizeHint().
98
99 QSizePolicy::Maximum - The sizeHint() is a maximum. The widget can be
100 shrunk any amount without detriment if other widgets need the space
101 (e.g. a separator line). It cannot be larger than the size provided by
102 sizeHint().
103
104 QSizePolicy::Preferred - The sizeHint() is best, but the widget can be
105 shrunk and still be useful. The widget can be expanded, but there is no
106 advantage to it being larger than sizeHint() (the default QWidget
107 policy).
108
109 QSizePolicy::Expanding - The sizeHint() is a sensible size, but the
110 widget can be shrunk and still be useful. The widget can make use of
111 extra space, so it should get as much space as possible (e.g. the
112 horizontal direction of a slider).
113
114 QSizePolicy::MinimumExpanding - The sizeHint() is minimal, and
115 sufficient. The widget can make use of extra space, so it should get as
116 much space as possible (e.g. the horizontal direction of a slider).
117
118 QSizePolicy::Ignored - the sizeHint() is ignored. The widget will get
119 as much space as possible.
120
123 Constructs a minimally initialized QSizePolicy.
124
126 This is the constructor normally used to return a value in the
127 overridden QWidget::sizePolicy() function of a QWidget subclass.
128
129 It constructs a QSizePolicy with independent horizontal and vertical
130 sizing types, hor and ver respectively. These sizing types affect how
131 the widget is treated by the layout engine.
132
133 If hfw is TRUE, the preferred height of the widget is dependent on the
134 width of the widget (for example, a QLabel with line wrapping).
135
136 See also horData(), verData(), and hasHeightForWidth().
137
139 verStretch, bool hfw = FALSE )
140 Constructs a QSizePolicy with independent horizontal and vertical
141 sizing types hor and ver, and stretch factors horStretch and
142 verStretch.
143
144 If hfw is TRUE, the preferred height of the widget is dependent on the
145 width of the widget.
146
147 See also horStretch() and verStretch().
148
150 Returns whether this layout can make use of more space than sizeHint().
151 A value of Vertical or Horizontal means that it wants to grow in only
152 one dimension, whereas BothDirections means that it wants to grow in
153 both dimensions.
154
155 See also mayShrinkHorizontally(), mayGrowHorizontally(),
156 mayShrinkVertically(), and mayGrowVertically().
157
159 Returns TRUE if the widget's preferred height depends on its width;
160 otherwise returns FALSE.
161
162 See also setHeightForWidth().
163
165 Returns the horizontal component of the size policy.
166
167 See also setHorData(), verData(), and horStretch().
168
170 Returns the horizontal stretch factor of the size policy.
171
172 See also setHorStretch() and verStretch().
173
175 Returns TRUE if the widget can sensibly be wider than its sizeHint();
176 otherwise returns FALSE.
177
178 See also mayGrowVertically() and mayShrinkHorizontally().
179
181 Returns TRUE if the widget can sensibly be taller than its sizeHint();
182 otherwise returns FALSE.
183
184 See also mayGrowHorizontally() and mayShrinkVertically().
185
187 Returns TRUE if the widget can sensibly be narrower than its
188 sizeHint(); otherwise returns FALSE.
189
190 See also mayShrinkVertically() and mayGrowHorizontally().
191
193 Returns TRUE if the widget can sensibly be shorter than its sizeHint();
194 otherwise returns FALSE.
195
196 See also mayShrinkHorizontally() and mayGrowVertically().
197
199 Returns TRUE if this policy is different from s; otherwise returns
200 FALSE.
201
202 See also operator==().
203
205 Returns TRUE if this policy is equal to s; otherwise returns FALSE.
206
207 See also operator!=().
208
210 Sets the hasHeightForWidth() flag to b.
211
212 See also hasHeightForWidth().
213
215 Sets the horizontal component of the size policy to size type d.
216
217 See also horData() and setVerData().
218
220 Sets the horizontal stretch factor of the size policy to sf.
221
222 See also horStretch() and setVerStretch().
223
225 Sets the vertical component of the size policy to size type d.
226
227 See also verData() and setHorData().
228
230 Sets the vertical stretch factor of the size policy to sf.
231
232 See also verStretch() and setHorStretch().
233
235 Swaps the horizontal and vertical policies and stretches.
236
238 Returns the vertical component of the size policy.
239
240 See also setVerData(), horData(), and verStretch().
241
243 Returns the vertical stretch factor of the size policy.
244
245 See also setVerStretch() and horStretch().
246
247
249 http://doc.trolltech.com/qsizepolicy.html
250 http://www.trolltech.com/faq/tech.html
251
253 Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com. See the
254 license file included in the distribution for a complete license
255 statement.
256
258 Generated automatically from the source code.
259
261 If you find a bug in Qt, please report it as described in
262 http://doc.trolltech.com/bughowto.html. Good bug reports help us to
263 help you. Thank you.
264
265 The definitive Qt documentation is provided in HTML format; it is
266 located at $QTDIR/doc/html and can be read using Qt Assistant or with a
267 web browser. This man page is provided as a convenience for those users
268 who prefer man pages, although this format is not officially supported
269 by Trolltech.
270
271 If you find errors in this manual page, please report them to qt-
272 bugs@trolltech.com. Please include the name of the manual page
273 (qsizepolicy.3qt) and the Qt version (3.3.8).
274
275
276
277Trolltech AS 2 February 2007 QSizePolicy(3qt)