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
|
'\" t
.TH QSizePolicy 3qt "2 February 2007" "Trolltech AS" \" -*- nroff -*-
.\" Copyright 1992-2007 Trolltech ASA. All rights reserved. See the
.\" license file included in the distribution for a complete license
.\" statement.
.\"
.ad l
.nh
.SH NAME
QSizePolicy \- Layout attribute describing horizontal and vertical resizing policy
.SH SYNOPSIS
\fC#include <qsizepolicy.h>\fR
.PP
.SS "Public Members"
.in +1c
.ti -1c
.BI "enum \fBSizeType\fR { Fixed = 0, Minimum = MayGrow, Maximum = MayShrink, Preferred = MayGrow | MayShrink, MinimumExpanding = MayGrow | ExpMask, Expanding = MayGrow | MayShrink | ExpMask, Ignored = ExpMask }"
.br
.ti -1c
.BI "enum \fBExpandData\fR { NoDirection = 0, Horizontally = 1, Vertically = 2, Horizontal = Horizontally, Vertical = Vertically, BothDirections = Horizontally | Vertically }"
.br
.ti -1c
.BI "\fBQSizePolicy\fR ()"
.br
.ti -1c
.BI "\fBQSizePolicy\fR ( SizeType hor, SizeType ver, bool hfw = FALSE )"
.br
.ti -1c
.BI "\fBQSizePolicy\fR ( SizeType hor, SizeType ver, uchar horStretch, uchar verStretch, bool hfw = FALSE )"
.br
.ti -1c
.BI "SizeType \fBhorData\fR () const"
.br
.ti -1c
.BI "SizeType \fBverData\fR () const"
.br
.ti -1c
.BI "bool \fBmayShrinkHorizontally\fR () const"
.br
.ti -1c
.BI "bool \fBmayShrinkVertically\fR () const"
.br
.ti -1c
.BI "bool \fBmayGrowHorizontally\fR () const"
.br
.ti -1c
.BI "bool \fBmayGrowVertically\fR () const"
.br
.ti -1c
.BI "ExpandData \fBexpanding\fR () const"
.br
.ti -1c
.BI "void \fBsetHorData\fR ( SizeType d )"
.br
.ti -1c
.BI "void \fBsetVerData\fR ( SizeType d )"
.br
.ti -1c
.BI "void \fBsetHeightForWidth\fR ( bool b )"
.br
.ti -1c
.BI "bool \fBhasHeightForWidth\fR () const"
.br
.ti -1c
.BI "bool \fBoperator==\fR ( const QSizePolicy & s ) const"
.br
.ti -1c
.BI "bool \fBoperator!=\fR ( const QSizePolicy & s ) const"
.br
.ti -1c
.BI "uint \fBhorStretch\fR () const"
.br
.ti -1c
.BI "uint \fBverStretch\fR () const"
.br
.ti -1c
.BI "void \fBsetHorStretch\fR ( uchar sf )"
.br
.ti -1c
.BI "void \fBsetVerStretch\fR ( uchar sf )"
.br
.ti -1c
.BI "void \fBtranspose\fR ()"
.br
.in -1c
.SH DESCRIPTION
The QSizePolicy class is a layout attribute describing horizontal and vertical resizing policy.
.PP
The size policy of a widget is an expression of its willingness to be resized in various ways.
.PP
Widgets that reimplement QWidget::sizePolicy() return a QSizePolicy that describes the horizontal and vertical resizing policy they prefer when being laid out. Only one of the constructors is of interest in most applications.
.PP
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.
.PP
The horizontal and vertical SizeTypes are set in the usual constructor and can be queried using a variety of functions.
.PP
The hasHeightForWidth() flag indicates whether the widget's sizeHint() is width-dependent (such as a word-wrapping label) or not.
.PP
See also QSizePolicy::SizeType, Widget Appearance and Style, and Layout Management.
.SS "Member Type Documentation"
.SH "QSizePolicy::ExpandData"
This enum type describes in which directions a widget can make use of extra space. There are four possible values:
.TP
\fCQSizePolicy::NoDirection\fR - the widget cannot make use of extra space in any direction.
.TP
\fCQSizePolicy::Horizontally\fR - the widget can usefully be wider than the sizeHint().
.TP
\fCQSizePolicy::Vertically\fR - the widget can usefully be taller than the sizeHint().
.TP
\fCQSizePolicy::BothDirections\fR - the widget can usefully be both wider and taller than the sizeHint().
.SH "QSizePolicy::SizeType"
The per-dimension sizing types used when constructing a QSizePolicy are:
.TP
\fCQSizePolicy::Fixed\fR - The QWidget::sizeHint() is the only acceptable alternative, so the widget can never grow or shrink (e.g. the vertical direction of a push button).
.TP
\fCQSizePolicy::Minimum\fR - 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().
.TP
\fCQSizePolicy::Maximum\fR - 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().
.TP
\fCQSizePolicy::Preferred\fR - 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 QWidget policy).
.TP
\fCQSizePolicy::Expanding\fR - 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).
.TP
\fCQSizePolicy::MinimumExpanding\fR - 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).
.TP
\fCQSizePolicy::Ignored\fR - the sizeHint() is ignored. The widget will get as much space as possible.
.SH MEMBER FUNCTION DOCUMENTATION
.SH "QSizePolicy::QSizePolicy ()"
Constructs a minimally initialized QSizePolicy.
.SH "QSizePolicy::QSizePolicy ( SizeType hor, SizeType ver, bool hfw = FALSE )"
This is the constructor normally used to return a value in the overridden QWidget::sizePolicy() function of a QWidget subclass.
.PP
It constructs a QSizePolicy with independent horizontal and vertical sizing types, \fIhor\fR and \fIver\fR respectively. These sizing types affect how the widget is treated by the layout engine.
.PP
If \fIhfw\fR is TRUE, the preferred height of the widget is dependent on the width of the widget (for example, a QLabel with line wrapping).
.PP
See also horData(), verData(), and hasHeightForWidth().
.SH "QSizePolicy::QSizePolicy ( SizeType hor, SizeType ver, uchar horStretch, uchar verStretch, bool hfw = FALSE )"
Constructs a QSizePolicy with independent horizontal and vertical sizing types \fIhor\fR and \fIver\fR, and stretch factors \fIhorStretch\fR and \fIverStretch\fR.
.PP
If \fIhfw\fR is TRUE, the preferred height of the widget is dependent on the width of the widget.
.PP
See also horStretch() and verStretch().
.SH "ExpandData QSizePolicy::expanding () const"
Returns whether this layout can make use of more space than sizeHint(). A value of Vertical or Horizontal means that it wants to grow in only one dimension, whereas BothDirections means that it wants to grow in both dimensions.
.PP
See also mayShrinkHorizontally(), mayGrowHorizontally(), mayShrinkVertically(), and mayGrowVertically().
.SH "bool QSizePolicy::hasHeightForWidth () const"
Returns TRUE if the widget's preferred height depends on its width; otherwise returns FALSE.
.PP
See also setHeightForWidth().
.SH "SizeType QSizePolicy::horData () const"
Returns the horizontal component of the size policy.
.PP
See also setHorData(), verData(), and horStretch().
.SH "uint QSizePolicy::horStretch () const"
Returns the horizontal stretch factor of the size policy.
.PP
See also setHorStretch() and verStretch().
.SH "bool QSizePolicy::mayGrowHorizontally () const"
Returns TRUE if the widget can sensibly be wider than its sizeHint(); otherwise returns FALSE.
.PP
See also mayGrowVertically() and mayShrinkHorizontally().
.SH "bool QSizePolicy::mayGrowVertically () const"
Returns TRUE if the widget can sensibly be taller than its sizeHint(); otherwise returns FALSE.
.PP
See also mayGrowHorizontally() and mayShrinkVertically().
.SH "bool QSizePolicy::mayShrinkHorizontally () const"
Returns TRUE if the widget can sensibly be narrower than its sizeHint(); otherwise returns FALSE.
.PP
See also mayShrinkVertically() and mayGrowHorizontally().
.SH "bool QSizePolicy::mayShrinkVertically () const"
Returns TRUE if the widget can sensibly be shorter than its sizeHint(); otherwise returns FALSE.
.PP
See also mayShrinkHorizontally() and mayGrowVertically().
.SH "bool QSizePolicy::operator!= ( const QSizePolicy & s ) const"
Returns TRUE if this policy is different from \fIs\fR; otherwise returns FALSE.
.PP
See also operator==().
.SH "bool QSizePolicy::operator== ( const QSizePolicy & s ) const"
Returns TRUE if this policy is equal to \fIs\fR; otherwise returns FALSE.
.PP
See also operator!=().
.SH "void QSizePolicy::setHeightForWidth ( bool b )"
Sets the hasHeightForWidth() flag to \fIb\fR.
.PP
See also hasHeightForWidth().
.SH "void QSizePolicy::setHorData ( SizeType d )"
Sets the horizontal component of the size policy to size type \fId\fR.
.PP
See also horData() and setVerData().
.SH "void QSizePolicy::setHorStretch ( uchar sf )"
Sets the horizontal stretch factor of the size policy to \fIsf\fR.
.PP
See also horStretch() and setVerStretch().
.SH "void QSizePolicy::setVerData ( SizeType d )"
Sets the vertical component of the size policy to size type \fId\fR.
.PP
See also verData() and setHorData().
.SH "void QSizePolicy::setVerStretch ( uchar sf )"
Sets the vertical stretch factor of the size policy to \fIsf\fR.
.PP
See also verStretch() and setHorStretch().
.SH "void QSizePolicy::transpose ()"
Swaps the horizontal and vertical policies and stretches.
.SH "SizeType QSizePolicy::verData () const"
Returns the vertical component of the size policy.
.PP
See also setVerData(), horData(), and verStretch().
.SH "uint QSizePolicy::verStretch () const"
Returns the vertical stretch factor of the size policy.
.PP
See also setVerStretch() and horStretch().
.SH "SEE ALSO"
.BR http://doc.trolltech.com/qsizepolicy.html
.BR http://www.trolltech.com/faq/tech.html
.SH COPYRIGHT
Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com. See the
license file included in the distribution for a complete license
statement.
.SH AUTHOR
Generated automatically from the source code.
.SH BUGS
If you find a bug in Qt, please report it as described in
.BR http://doc.trolltech.com/bughowto.html .
Good bug reports help us to help you. Thank you.
.P
The definitive Qt documentation is provided in HTML format; it is
located at $QTDIR/doc/html and can be read using Qt Assistant or with
a web browser. This man page is provided as a convenience for those
users who prefer man pages, although this format is not officially
supported by Trolltech.
.P
If you find errors in this manual page, please report them to
.BR qt-bugs@trolltech.com .
Please include the name of the manual page (qsizepolicy.3qt) and the Qt
version (3.3.8).
|