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 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370
|
'\" t
.TH QSize 3qt "21 January 2005" "Trolltech AS" \" -*- nroff -*-
.\" Copyright 1992-2001 Trolltech AS. All rights reserved. See the
.\" license file included in the distribution for a complete license
.\" statement.
.\"
.ad l
.nh
.SH NAME
QSize \- Defines the size of a two-dimensional object
.SH SYNOPSIS
\fC#include <qsize.h>\fR
.PP
.SS "Public Members"
.in +1c
.ti -1c
.BI "enum \fBScaleMode\fR { ScaleFree, ScaleMin, ScaleMax }"
.br
.ti -1c
.BI "\fBQSize\fR ()"
.br
.ti -1c
.BI "\fBQSize\fR ( int w, int h )"
.br
.ti -1c
.BI "bool \fBisNull\fR () const"
.br
.ti -1c
.BI "bool \fBisEmpty\fR () const"
.br
.ti -1c
.BI "bool \fBisValid\fR () const"
.br
.ti -1c
.BI "int \fBwidth\fR () const"
.br
.ti -1c
.BI "int \fBheight\fR () const"
.br
.ti -1c
.BI "void \fBsetWidth\fR ( int w )"
.br
.ti -1c
.BI "void \fBsetHeight\fR ( int h )"
.br
.ti -1c
.BI "void \fBtranspose\fR ()"
.br
.ti -1c
.BI "void \fBscale\fR ( int w, int h, ScaleMode mode )"
.br
.ti -1c
.BI "void \fBscale\fR ( const QSize & s, ScaleMode mode )"
.br
.ti -1c
.BI "QSize \fBexpandedTo\fR ( const QSize & otherSize ) const"
.br
.ti -1c
.BI "QSize \fBboundedTo\fR ( const QSize & otherSize ) const"
.br
.ti -1c
.BI "QCOORD & \fBrwidth\fR ()"
.br
.ti -1c
.BI "QCOORD & \fBrheight\fR ()"
.br
.ti -1c
.BI "QSize & \fBoperator+=\fR ( const QSize & s )"
.br
.ti -1c
.BI "QSize & \fBoperator-=\fR ( const QSize & s )"
.br
.ti -1c
.BI "QSize & \fBoperator*=\fR ( int c )"
.br
.ti -1c
.BI "QSize & \fBoperator*=\fR ( double c )"
.br
.ti -1c
.BI "QSize & \fBoperator/=\fR ( int c )"
.br
.ti -1c
.BI "QSize & \fBoperator/=\fR ( double c )"
.br
.in -1c
.SH RELATED FUNCTION DOCUMENTATION
.in +1c
.ti -1c
.BI "bool \fBoperator==\fR ( const QSize & s1, const QSize & s2 )"
.br
.ti -1c
.BI "bool \fBoperator!=\fR ( const QSize & s1, const QSize & s2 )"
.br
.ti -1c
.BI "const QSize \fBoperator+\fR ( const QSize & s1, const QSize & s2 )"
.br
.ti -1c
.BI "const QSize \fBoperator-\fR ( const QSize & s1, const QSize & s2 )"
.br
.ti -1c
.BI "const QSize \fBoperator*\fR ( const QSize & s, int c )"
.br
.ti -1c
.BI "const QSize \fBoperator*\fR ( int c, const QSize & s )"
.br
.ti -1c
.BI "const QSize \fBoperator*\fR ( const QSize & s, double c )"
.br
.ti -1c
.BI "const QSize \fBoperator*\fR ( double c, const QSize & s )"
.br
.ti -1c
.BI "const QSize \fBoperator/\fR ( const QSize & s, int c )"
.br
.ti -1c
.BI "const QSize \fBoperator/\fR ( const QSize & s, double c )"
.br
.ti -1c
.BI "QDataStream & \fBoperator<<\fR ( QDataStream & s, const QSize & sz )"
.br
.ti -1c
.BI "QDataStream & \fBoperator>>\fR ( QDataStream & s, QSize & sz )"
.br
.in -1c
.SH DESCRIPTION
The QSize class defines the size of a two-dimensional object.
.PP
A size is specified by a width and a height.
.PP
The coordinate type is QCOORD (defined in \fC<qwindowdefs.h>\fR as \fCint\fR). The minimum value of QCOORD is QCOORD_MIN (-2147483648) and the maximum value is QCOORD_MAX (2147483647).
.PP
The size can be set in the constructor and changed with setWidth() and setHeight(), or using operator+=(), operator-=(), operator*=() and operator/=(), etc. You can swap the width and height with transpose(). You can get a size which holds the maximum height and width of two sizes using expandedTo(), and the minimum height and width of two sizes using boundedTo().
.PP
See also QPoint, QRect, Graphics Classes, and Image Processing Classes.
.SS "Member Type Documentation"
.SH "QSize::ScaleMode"
This enum type defines the different ways of scaling a size.
.PP
<center>
.ce 1
.B "[Image Omitted]"
.PP
</center>
.TP
\fCQSize::ScaleFree\fR - The size is scaled freely. The ratio is not preserved.
.TP
\fCQSize::ScaleMin\fR - The size is scaled to a rectangle as large as possible inside a given rectangle, preserving the aspect ratio.
.TP
\fCQSize::ScaleMax\fR - The size is scaled to a rectangle as small as possible outside a given rectangle, preserving the aspect ratio.
.PP
See also QSize::scale(), QImage::scale(), and QImage::smoothScale().
.SH MEMBER FUNCTION DOCUMENTATION
.SH "QSize::QSize ()"
Constructs a size with invalid (negative) width and height.
.SH "QSize::QSize ( int w, int h )"
Constructs a size with width \fIw\fR and height \fIh\fR.
.SH "QSize QSize::boundedTo ( const QSize & otherSize ) const"
Returns a size with the minimum width and height of this size and \fIotherSize\fR.
.SH "QSize QSize::expandedTo ( const QSize & otherSize ) const"
Returns a size with the maximum width and height of this size and \fIotherSize\fR.
.PP
Examples:
.)l customlayout/card.cpp and customlayout/flow.cpp.
.SH "int QSize::height () const"
Returns the height.
.PP
See also width().
.PP
Examples:
.)l movies/main.cpp, qfd/fontdisplayer.cpp, and qfd/qfd.cpp.
.SH "bool QSize::isEmpty () const"
Returns TRUE if the width is less than or equal to 0, or the height is less than or equal to 0; otherwise returns FALSE.
.SH "bool QSize::isNull () const"
Returns TRUE if the width is 0 and the height is 0; otherwise returns FALSE.
.SH "bool QSize::isValid () const"
Returns TRUE if the width is equal to or greater than 0 and the height is equal to or greater than 0; otherwise returns FALSE.
.SH "QSize & QSize::operator*= ( int c )"
Multiplies both the width and height by \fIc\fR and returns a reference to the size.
.SH "QSize & QSize::operator*= ( double c )"
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
.PP
Multiplies both the width and height by \fIc\fR and returns a reference to the size.
.PP
Note that the result is truncated.
.SH "QSize & QSize::operator+= ( const QSize & s )"
Adds \fIs\fR to the size and returns a reference to this size.
.PP
Example:
.PP
.nf
.br
QSize s( 3, 7 );
.br
QSize r( -1, 4 );
.br
s += r; // s becomes (2,11)
.fi
.SH "QSize & QSize::operator-= ( const QSize & s )"
Subtracts \fIs\fR from the size and returns a reference to this size.
.PP
Example:
.PP
.nf
.br
QSize s( 3, 7 );
.br
QSize r( -1, 4 );
.br
s -= r; // s becomes (4,3)
.br
.fi
.SH "QSize & QSize::operator/= ( int c )"
Divides both the width and height by \fIc\fR and returns a reference to the size.
.SH "QSize & QSize::operator/= ( double c )"
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
.PP
Divides both the width and height by \fIc\fR and returns a reference to the size.
.PP
Note that the result is truncated.
.SH "QCOORD & QSize::rheight ()"
Returns a reference to the height.
.PP
Using a reference makes it possible to directly manipulate the height.
.PP
Example:
.PP
.nf
.br
QSize s( 100, 10 );
.br
s.rheight() += 5; // s becomes (100,15)
.br
.fi
.PP
See also rwidth().
.SH "QCOORD & QSize::rwidth ()"
Returns a reference to the width.
.PP
Using a reference makes it possible to directly manipulate the width.
.PP
Example:
.PP
.nf
.br
QSize s( 100, 10 );
.br
s.rwidth() += 20; // s becomes (120,10)
.br
.fi
.PP
See also rheight().
.SH "void QSize::scale ( int w, int h, ScaleMode mode )"
Scales the size to a rectangle of width \fIw\fR and height \fIh\fR according to the ScaleMode \fImode\fR.
.TP
If \fImode\fR is ScaleFree, the size is set to (\fIw\fR, \fIh\fR).
.TP
If \fImode\fR is ScaleMin, the current size is scaled to a rectangle as large as possible inside (\fIw\fR, \fIh\fR), preserving the aspect ratio.
.TP
If \fImode\fR is ScaleMax, the current size is scaled to a rectangle as small as possible outside (\fIw\fR, \fIh\fR), preserving the aspect ratio.
.PP
Example:
.PP
.nf
.br
QSize t1( 10, 12 );
.br
t1.scale( 60, 60, QSize::ScaleFree );
.br
// t1 is (60, 60)
.br
.br
QSize t2( 10, 12 );
.br
t2.scale( 60, 60, QSize::ScaleMin );
.br
// t2 is (50, 60)
.br
.br
QSize t3( 10, 12 );
.br
t3.scale( 60, 60, QSize::ScaleMax );
.br
// t3 is (60, 72)
.br
.fi
.SH "void QSize::scale ( const QSize & s, ScaleMode mode )"
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
.PP
Equivalent to scale(\fIs\fR.width(), \fIs\fR.height(), \fImode\fR).
.SH "void QSize::setHeight ( int h )"
Sets the height to \fIh\fR.
.PP
See also height() and setWidth().
.SH "void QSize::setWidth ( int w )"
Sets the width to \fIw\fR.
.PP
See also width() and setHeight().
.SH "void QSize::transpose ()"
Swaps the values of width and height.
.SH "int QSize::width () const"
Returns the width.
.PP
See also height().
.PP
Examples:
.)l movies/main.cpp, qfd/fontdisplayer.cpp, and qfd/qfd.cpp.
.SH RELATED FUNCTION DOCUMENTATION
.SH "bool operator!= ( const QSize & s1, const QSize & s2 )"
Returns TRUE if \fIs1\fR and \fIs2\fR are different; otherwise returns FALSE.
.SH "const QSize operator* ( const QSize & s, int c )"
Multiplies \fIs\fR by \fIc\fR and returns the result.
.SH "const QSize operator* ( int c, const QSize & s )"
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
.PP
Multiplies \fIs\fR by \fIc\fR and returns the result.
.SH "const QSize operator* ( const QSize & s, double c )"
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
.PP
Multiplies \fIs\fR by \fIc\fR and returns the result.
.SH "const QSize operator* ( double c, const QSize & s )"
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
.PP
Multiplies \fIs\fR by \fIc\fR and returns the result.
.SH "const QSize operator+ ( const QSize & s1, const QSize & s2 )"
Returns the sum of \fIs1\fR and \fIs2\fR; each component is added separately.
.SH "const QSize operator- ( const QSize & s1, const QSize & s2 )"
Returns \fIs2\fR subtracted from \fIs1\fR; each component is subtracted separately.
.SH "const QSize operator/ ( const QSize & s, int c )"
Divides \fIs\fR by \fIc\fR and returns the result.
.SH "const QSize operator/ ( const QSize & s, double c )"
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
.PP
Divides \fIs\fR by \fIc\fR and returns the result.
.PP
Note that the result is truncated.
.SH "QDataStream & operator<< ( QDataStream & s, const QSize & sz )"
Writes the size \fIsz\fR to the stream \fIs\fR and returns a reference to the stream.
.PP
See also Format of the QDataStream operators.
.SH "bool operator== ( const QSize & s1, const QSize & s2 )"
Returns TRUE if \fIs1\fR and \fIs2\fR are equal; otherwise returns FALSE.
.SH "QDataStream & operator>> ( QDataStream & s, QSize & sz )"
Reads the size from the stream \fIs\fR into size \fIsz\fR and returns a reference to the stream.
.PP
See also Format of the QDataStream operators.
.SH "SEE ALSO"
.BR http://doc.trolltech.com/qsize.html
.BR http://www.trolltech.com/faq/tech.html
.SH COPYRIGHT
Copyright 1992-2001 Trolltech AS, 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 (qsize.3qt) and the Qt
version (3.3.4).
|