QSizeF Class
The QSizeF class defines the size of a two-dimensional object using floating point precision. More...
Header: | #include <QSizeF> |
qmake: | QT += core |
Public Functions
QSizeF | scaled(const QSizeF &s, Qt::AspectRatioMode mode) const |
CGSize | toCGSize() const |
void | transpose() |
Static Public Members
QSizeF | fromCGSize(CGSize size) |
Detailed Description
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() function.
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() function 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.
See also QSize, QPointF, and QRectF.
Member Function Documentation
[static]
QSizeF QSizeF::fromCGSize(CGSize size)
Creates a QRectF from size.
This function was introduced in Qt 5.8.
See also toCGSize().
QSizeF QSizeF::scaled(const QSizeF &s, Qt::AspectRatioMode mode) const
This is an overloaded function.
Returns a size scaled to a rectangle with the given size s, according to the specified mode.
This function was introduced in Qt 5.0.
CGSize QSizeF::toCGSize() const
Creates a CGSize from a QSizeF.
This function was introduced in Qt 5.8.
See also fromCGSize().
void QSizeF::transpose()
Swaps the width and height values.
See also setWidth(), setHeight(), and transposed().