Eneboo - Documentación para desarrolladores
|
The QSize class defines the size of a two-dimensional object. Más...
#include <qsize.h>
The QSize class defines the size of a two-dimensional object.
A size is specified by a width and a height.
The coordinate type is QCOORD (defined in <qwindowdefs.h>
as int
). The minimum value of QCOORD is QCOORD_MIN (-2147483648) and the maximum value is QCOORD_MAX (2147483647).
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().
enum QSize::ScaleMode |
This enum type defines the different ways of scaling a size.
scaling.png
ScaleFree The size is scaled freely. The ratio is not preserved. ScaleMin The size is scaled to a rectangle as large as possible inside a given rectangle, preserving the aspect ratio. ScaleMax The size is scaled to a rectangle as small as possible outside a given rectangle, preserving the aspect ratio.
enum QSize::ScaleMode |
QSize::QSize | ( | ) | [inline] |
Constructs a size with invalid (negative) width and height.
QSize::QSize | ( | ) |
Returns a size with the minimum width and height of this size and otherSize.
Returns a size with the maximum width and height of this size and otherSize.
int QSize::height | ( | ) | const |
bool QSize::isEmpty | ( | void | ) | const [inline] |
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.
bool QSize::isEmpty | ( | ) | const |
bool QSize::isNull | ( | ) | const |
bool QSize::isNull | ( | ) | const [inline] |
Returns TRUE if the width is 0 and the height is 0; otherwise returns FALSE.
bool QSize::isValid | ( | ) | const |
bool QSize::isValid | ( | void | ) | const [inline] |
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.
Multiplies both the width and height by c and returns a reference to the size.
QSize & QSize::operator*= | ( | double | c | ) | [inline] |
QSize& QSize::operator*= | ( | double | c | ) |
QSize& QSize::operator/= | ( | double | c | ) |
QSize & QSize::operator/= | ( | double | c | ) | [inline] |
Esta es una función miembro sobrecargada que se suministra por conveniencia. Difiere de la anterior función solamente en los argumentos que acepta. Divides both the width and height by c and returns a reference to the size.
Note that the result is truncated.
Divides both the width and height by c and returns a reference to the size.
QCOORD& QSize::rheight | ( | ) |
QCOORD & QSize::rheight | ( | ) | [inline] |
QCOORD& QSize::rwidth | ( | ) |
QCOORD & QSize::rwidth | ( | ) | [inline] |
Scales the size to a rectangle of width w and height h according to the ScaleMode mode.
If mode is ScaleFree
, the size is set to (w, h). If mode is ScaleMin
, the current size is scaled to a rectangle as large as possible inside (w, h), preserving the aspect ratio. If mode is ScaleMax
, the current size is scaled to a rectangle as small as possible outside (w, h), preserving the aspect ratio.
Example:
QSize t1( 10, 12 ); t1.scale( 60, 60, QSize::ScaleFree ); // t1 is (60, 60) QSize t2( 10, 12 ); t2.scale( 60, 60, QSize::ScaleMin ); // t2 is (50, 60) QSize t3( 10, 12 ); t3.scale( 60, 60, QSize::ScaleMax ); // t3 is (60, 72)
void QSize::setHeight | ( | int | h | ) |
void QSize::setHeight | ( | int | h | ) | [inline] |
Sets the height to h.
void QSize::setWidth | ( | int | w | ) |
void QSize::setWidth | ( | int | w | ) | [inline] |
Sets the width to w.
void QSize::transpose | ( | ) |
void QSize::transpose | ( | ) |
Swaps the values of width and height.
int QSize::width | ( | ) | const |
const QSize operator [related] |
Multiplies s by c and returns the result.
const QSize operator [related] |
Multiplies s by c and returns the result.
const QSize operator [related] |
Multiplies s by c and returns the result.
Returns TRUE if s1 and s2 are different; otherwise returns FALSE.
Returns the sum of s1 and s2; each component is added separately.
Returns s2 subtracted from s1; each component is subtracted separately.
Esta es una función miembro sobrecargada que se suministra por conveniencia. Difiere de la anterior función solamente en los argumentos que acepta. Divides s by c and returns the result.
Note that the result is truncated.
QDataStream & operator<< | ( | QDataStream & | s, |
const QSize & | sz | ||
) | [related] |
Writes the size sz to the stream s and returns a reference to the stream.
Returns TRUE if s1 and s2 are equal; otherwise returns FALSE.
QDataStream & operator>> | ( | QDataStream & | s, |
QSize & | sz | ||
) | [related] |
Reads the size from the stream s into size sz and returns a reference to the stream.