1QSize(3qt)                                                          QSize(3qt)
2
3
4

NAME

6       QSize - Defines the size of a two-dimensional object
7

SYNOPSIS

9       #include <qsize.h>
10
11   Public Members
12       enum ScaleMode { ScaleFree, ScaleMin, ScaleMax }
13       QSize ()
14       QSize ( int w, int h )
15       bool isNull () const
16       bool isEmpty () const
17       bool isValid () const
18       int width () const
19       int height () const
20       void setWidth ( int w )
21       void setHeight ( int h )
22       void transpose ()
23       void scale ( int w, int h, ScaleMode mode )
24       void scale ( const QSize & s, ScaleMode mode )
25       QSize expandedTo ( const QSize & otherSize ) const
26       QSize boundedTo ( const QSize & otherSize ) const
27       QCOORD & rwidth ()
28       QCOORD & rheight ()
29       QSize & operator+= ( const QSize & s )
30       QSize & operator-= ( const QSize & s )
31       QSize & operator*= ( int c )
32       QSize & operator*= ( double c )
33       QSize & operator/= ( int c )
34       QSize & operator/= ( double c )
35
37       bool operator== ( const QSize & s1, const QSize & s2 )
38       bool operator!= ( const QSize & s1, const QSize & s2 )
39       const QSize operator+ ( const QSize & s1, const QSize & s2 )
40       const QSize operator- ( const QSize & s1, const QSize & s2 )
41       const QSize operator* ( const QSize & s, int c )
42       const QSize operator* ( int c, const QSize & s )
43       const QSize operator* ( const QSize & s, double c )
44       const QSize operator* ( double c, const QSize & s )
45       const QSize operator/ ( const QSize & s, int c )
46       const QSize operator/ ( const QSize & s, double c )
47       QDataStream & operator<< ( QDataStream & s, const QSize & sz )
48       QDataStream & operator>> ( QDataStream & s, QSize & sz )
49

DESCRIPTION

51       The QSize class defines the size of a two-dimensional object.
52
53       A size is specified by a width and a height.
54
55       The coordinate type is QCOORD (defined in <qwindowdefs.h> as int). The
56       minimum value of QCOORD is QCOORD_MIN (-2147483648) and the maximum
57       value is QCOORD_MAX (2147483647).
58
59       The size can be set in the constructor and changed with setWidth() and
60       setHeight(), or using operator+=(), operator-=(), operator*=() and
61       operator/=(), etc. You can swap the width and height with transpose().
62       You can get a size which holds the maximum height and width of two
63       sizes using expandedTo(), and the minimum height and width of two sizes
64       using boundedTo().
65
66       See also QPoint, QRect, Graphics Classes, and Image Processing Classes.
67
68   Member Type Documentation

QSize::ScaleMode

70       This enum type defines the different ways of scaling a size.
71
72       <center>
73                                   [Image Omitted]
74
75       </center>
76
77       QSize::ScaleFree - The size is scaled freely. The ratio is not
78       preserved.
79
80       QSize::ScaleMin - The size is scaled to a rectangle as large as
81       possible inside a given rectangle, preserving the aspect ratio.
82
83       QSize::ScaleMax - The size is scaled to a rectangle as small as
84       possible outside a given rectangle, preserving the aspect ratio.
85
86       See also QSize::scale(), QImage::scale(), and QImage::smoothScale().
87

MEMBER FUNCTION DOCUMENTATION

QSize::QSize ()

90       Constructs a size with invalid (negative) width and height.
91

QSize::QSize ( int w, int h )

93       Constructs a size with width w and height h.
94

QSize QSize::boundedTo ( const QSize & otherSize ) const

96       Returns a size with the minimum width and height of this size and
97       otherSize.
98

QSize QSize::expandedTo ( const QSize & otherSize ) const

100       Returns a size with the maximum width and height of this size and
101       otherSize.
102
103       Examples:
104

int QSize::height () const

106       Returns the height.
107
108       See also width().
109
110       Examples:
111

bool QSize::isEmpty () const

113       Returns TRUE if the width is less than or equal to 0, or the height is
114       less than or equal to 0; otherwise returns FALSE.
115

bool QSize::isNull () const

117       Returns TRUE if the width is 0 and the height is 0; otherwise returns
118       FALSE.
119

bool QSize::isValid () const

121       Returns TRUE if the width is equal to or greater than 0 and the height
122       is equal to or greater than 0; otherwise returns FALSE.
123

QSize & QSize::operator*= ( int c )

125       Multiplies both the width and height by c and returns a reference to
126       the size.
127

QSize & QSize::operator*= ( double c )

129       This is an overloaded member function, provided for convenience. It
130       behaves essentially like the above function.
131
132       Multiplies both the width and height by c and returns a reference to
133       the size.
134
135       Note that the result is truncated.
136

QSize & QSize::operator+= ( const QSize & s )

138       Adds s to the size and returns a reference to this size.
139
140       Example:
141
142           QSize s(  3, 7 );
143           QSize r( -1, 4 );
144           s += r;                     // s becomes (2,11)
145

QSize & QSize::operator-= ( const QSize & s )

147       Subtracts s from the size and returns a reference to this size.
148
149       Example:
150
151           QSize s(  3, 7 );
152           QSize r( -1, 4 );
153           s -= r;                     // s becomes (4,3)
154

QSize & QSize::operator/= ( int c )

156       Divides both the width and height by c and returns a reference to the
157       size.
158

QSize & QSize::operator/= ( double c )

160       This is an overloaded member function, provided for convenience. It
161       behaves essentially like the above function.
162
163       Divides both the width and height by c and returns a reference to the
164       size.
165
166       Note that the result is truncated.
167

QCOORD & QSize::rheight ()

169       Returns a reference to the height.
170
171       Using a reference makes it possible to directly manipulate the height.
172
173       Example:
174
175           QSize s( 100, 10 );
176           s.rheight() += 5;           // s becomes (100,15)
177
178       See also rwidth().
179

QCOORD & QSize::rwidth ()

181       Returns a reference to the width.
182
183       Using a reference makes it possible to directly manipulate the width.
184
185       Example:
186
187           QSize s( 100, 10 );
188           s.rwidth() += 20;           // s becomes (120,10)
189
190       See also rheight().
191

void QSize::scale ( int w, int h, ScaleMode mode )

193       Scales the size to a rectangle of width w and height h according to the
194       ScaleMode mode.
195
196       If mode is ScaleFree, the size is set to (w, h).
197
198       If mode is ScaleMin, the current size is scaled to a rectangle as large
199       as possible inside (w, h), preserving the aspect ratio.
200
201       If mode is ScaleMax, the current size is scaled to a rectangle as small
202       as possible outside (w, h), preserving the aspect ratio.
203
204       Example:
205
206           QSize t1( 10, 12 );
207           t1.scale( 60, 60, QSize::ScaleFree );
208           // t1 is (60, 60)
209           QSize t2( 10, 12 );
210           t2.scale( 60, 60, QSize::ScaleMin );
211           // t2 is (50, 60)
212           QSize t3( 10, 12 );
213           t3.scale( 60, 60, QSize::ScaleMax );
214           // t3 is (60, 72)
215

void QSize::scale ( const QSize & s, ScaleMode mode )

217       This is an overloaded member function, provided for convenience. It
218       behaves essentially like the above function.
219
220       Equivalent to scale(s.width(), s.height(), mode).
221

void QSize::setHeight ( int h )

223       Sets the height to h.
224
225       See also height() and setWidth().
226

void QSize::setWidth ( int w )

228       Sets the width to w.
229
230       See also width() and setHeight().
231

void QSize::transpose ()

233       Swaps the values of width and height.
234

int QSize::width () const

236       Returns the width.
237
238       See also height().
239
240       Examples:
241

bool operator!= ( const QSize & s1, const QSize & s2 )

244       Returns TRUE if s1 and s2 are different; otherwise returns FALSE.
245

const QSize operator* ( const QSize & s, int c )

247       Multiplies s by c and returns the result.
248

const QSize operator* ( int c, const QSize & s )

250       This is an overloaded member function, provided for convenience. It
251       behaves essentially like the above function.
252
253       Multiplies s by c and returns the result.
254

const QSize operator* ( const QSize & s, double c )

256       This is an overloaded member function, provided for convenience. It
257       behaves essentially like the above function.
258
259       Multiplies s by c and returns the result.
260

const QSize operator* ( double c, const QSize & s )

262       This is an overloaded member function, provided for convenience. It
263       behaves essentially like the above function.
264
265       Multiplies s by c and returns the result.
266

const QSize operator+ ( const QSize & s1, const QSize & s2 )

268       Returns the sum of s1 and s2; each component is added separately.
269

const QSize operator- ( const QSize & s1, const QSize & s2 )

271       Returns s2 subtracted from s1; each component is subtracted separately.
272

const QSize operator/ ( const QSize & s, int c )

274       Divides s by c and returns the result.
275

const QSize operator/ ( const QSize & s, double c )

277       This is an overloaded member function, provided for convenience. It
278       behaves essentially like the above function.
279
280       Divides s by c and returns the result.
281
282       Note that the result is truncated.
283

QDataStream & operator<< ( QDataStream & s, const QSize & sz )

285       Writes the size sz to the stream s and returns a reference to the
286       stream.
287
288       See also Format of the QDataStream operators.
289

bool operator== ( const QSize & s1, const QSize & s2 )

291       Returns TRUE if s1 and s2 are equal; otherwise returns FALSE.
292

QDataStream & operator>> ( QDataStream & s, QSize & sz )

294       Reads the size from the stream s into size sz and returns a reference
295       to the stream.
296
297       See also Format of the QDataStream operators.
298
299

SEE ALSO

301       http://doc.trolltech.com/qsize.html
302       http://www.trolltech.com/faq/tech.html
303
305       Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com.  See the
306       license file included in the distribution for a complete license
307       statement.
308

AUTHOR

310       Generated automatically from the source code.
311

BUGS

313       If you find a bug in Qt, please report it as described in
314       http://doc.trolltech.com/bughowto.html.  Good bug reports help us to
315       help you. Thank you.
316
317       The definitive Qt documentation is provided in HTML format; it is
318       located at $QTDIR/doc/html and can be read using Qt Assistant or with a
319       web browser. This man page is provided as a convenience for those users
320       who prefer man pages, although this format is not officially supported
321       by Trolltech.
322
323       If you find errors in this manual page, please report them to qt-
324       bugs@trolltech.com.  Please include the name of the manual page
325       (qsize.3qt) and the Qt version (3.3.8).
326
327
328
329Trolltech AS                    2 February 2007                     QSize(3qt)
Impressum