CopperSpice API
1.9.1
|
The QSizeF class defines the size of a two-dimensional object using floating point precision. More...
Public Methods | |
QSizeF () | |
QSizeF (const QSize &size) | |
QSizeF (qreal width, qreal height) | |
QSizeF | boundedTo (const QSizeF &other) const |
QSizeF | expandedTo (const QSizeF &other) const |
qreal | height () const |
bool | isEmpty () const |
bool | isNull () const |
bool | isValid () const |
QSizeF & | operator*= (qreal factor) |
QSizeF & | operator+= (const QSizeF &size) |
QSizeF & | operator-= (const QSizeF &size) |
QSizeF & | operator/= (qreal factor) |
qreal & | rheight () |
qreal & | rwidth () |
void | scale (const QSizeF &size, Qt::AspectRatioMode mode) |
void | scale (qreal width, qreal height, Qt::AspectRatioMode mode) |
QSizeF | scaled (const QSizeF &size, Qt::AspectRatioMode mode) const |
QSizeF | scaled (qreal width, qreal height, Qt::AspectRatioMode mode) const |
void | setHeight (qreal height) |
void | setWidth (qreal width) |
QSize | toSize () const |
void | transpose () |
QSizeF | transposed () const |
qreal | width () const |
Friends | |
bool | operator!= (const QSizeF &size1, const QSizeF &size2) |
const QSizeF | operator* (const QSizeF &size, qreal factor) |
const QSizeF | operator* (qreal factor, const QSizeF &size) |
const QSizeF | operator+ (const QSizeF &size1, const QSizeF &size2) |
const QSizeF | operator- (const QSizeF &size1, const QSizeF &size2) |
const QSizeF | operator/ (const QSizeF &size, qreal factor) |
bool | operator== (const QSizeF &size1, const QSizeF &size2) |
Related Functions | |
These are not member functions | |
QDataStream & | operator<< (QDataStream &stream, const QSizeF &sizeF) |
QDataStream & | operator>> (QDataStream &stream, QSizeF &sizeF) |
The QSizeF class defines the size of a two-dimensional object using floating point precision.
A size is specified by a width() and a height(). It can be set in the constructor and changed using the setWidth(), setHeight(), or scale() functions, or using arithmetic operators. A size can also be manipulated directly by retrieving references to the width and height using the rwidth() and rheight() functions. Finally, the width and height can be swapped using the transpose() method.
The isValid() function determines if a size is valid. A valid size has both width and height greater than or equal to zero. The isEmpty() function returns true if either of the width and height is less than (or equal to) zero, while the isNull() function returns true only if both the width and the height is zero.
Use the expandedTo() method to retrieve a size which holds the maximum height and width of this size and a given size. Similarly, the boundedTo() function returns a size which holds the minimum height and width of this size and a given size.
The QSizeF class also provides the toSize() function returning a QSize copy of this size, constructed by rounding the width and height to the nearest integers.
QSizeF objects can be streamed as well as compared.
|
inline |
Constructs an invalid size.
|
inline |
Constructs a size with floating point accuracy from the given size.
Constructs a size with the given width and height.
|
inline |
Returns a size holding the minimum width and height of this size and the given other.
|
inline |
Returns a size holding the maximum width and height of this size and the given other.
|
inline |
Returns the height.
|
inline |
|
inline |
|
inline |
|
inline |
Multiplies both the width and height by the given factor and returns a reference to the size.
|
inline |
|
inline |
|
inline |
Divides both the width and height by the given factor and returns a reference to the size.
|
inline |
Returns a reference to the height. Using a reference makes it possible to manipulate the height directly.
|
inline |
Returns a reference to the width. Using a reference makes it possible to manipulate the width directly.
|
inline |
Scales the size to a rectangle with the given size, according to the specified mode.
|
inline |
Scales the size to a rectangle with the given width and height according to the specified mode.
QSizeF QSizeF::scaled | ( | const QSizeF & | size, |
Qt::AspectRatioMode | mode | ||
) | const |
Returns a size scaled to a rectangle with the given size, according to the specified mode.
|
inline |
Returns a size scaled to a rectangle with the given width and height, according to the specified mode.
|
inline |
Sets the height to the given height.
|
inline |
Sets the width to the given width.
|
inline |
Returns an integer based copy of this size. The coordinates in the returned size will be rounded to the nearest integer.
void QSizeF::transpose | ( | ) |
Swaps the width and height values.
|
inline |
Returns the size with width and height values swapped.
|
inline |
Returns the width.
|
friend |
Returns true if size1 and size2 are different, otherwise returns false.
|
friend |
Multiplies the given size by the given factor and returns the result.
|
friend |
Multiplies the given size by the given factor and returns the result.
|
friend |
Returns the sum of size1 and size2, each component is added separately.
|
friend |
Returns size2 subtracted from size1, each component is subtracted separately.
|
friend |
Divides the given size by the given factor and returns the result.
|
related |
Writes sizeF to the stream and returns a reference to the stream.
Refer to Serializing Data Types for additional information.
|
friend |
Returns true if size1 and size2 are equal, otherwise returns false.
|
related |
Reads from the stream into sizeF and returns a reference to the stream.
Refer to Serializing Data Types for additional information.