|
constexpr | QSizeF () noexcept |
| Constructs an invalid size.
|
|
constexpr | QSizeF (const QSize &sz) noexcept |
| Constructs a size with floating point accuracy from the given size.
|
|
constexpr | QSizeF (qreal w, qreal h) noexcept |
| Constructs a size with the given finite width and height.
|
|
bool | isNull () const noexcept |
| Returns true if both the width and height are 0.0 (ignoring the sign); otherwise returns false .
|
|
constexpr bool | isEmpty () const noexcept |
| Returns true if either of the width and height is less than or equal to 0; otherwise returns false .
|
|
constexpr bool | isValid () const noexcept |
| Returns true if both the width and height are equal to or greater than 0; otherwise returns false .
|
|
constexpr qreal | width () const noexcept |
| Returns the width.
|
|
constexpr qreal | height () const noexcept |
| Returns the height.
|
|
constexpr void | setWidth (qreal w) noexcept |
| Sets the width to the given finite width.
|
|
constexpr void | setHeight (qreal h) noexcept |
| Sets the height to the given finite height.
|
|
void | transpose () noexcept |
| Swaps the width and height values.
|
|
constexpr QSizeF | transposed () const noexcept |
|
void | scale (qreal w, qreal h, Qt::AspectRatioMode mode) noexcept |
| Scales the size to a rectangle with the given width and height, according to the specified mode.
|
|
void | scale (const QSizeF &s, Qt::AspectRatioMode mode) noexcept |
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Scales the size to a rectangle with the given size, according to the specified mode.
|
|
QSizeF | scaled (qreal w, qreal h, Qt::AspectRatioMode mode) const noexcept |
|
QSizeF | scaled (const QSizeF &s, Qt::AspectRatioMode mode) const noexcept |
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
|
|
constexpr QSizeF | expandedTo (const QSizeF &) const noexcept |
| Returns a size holding the maximum width and height of this size and the given otherSize.
|
|
constexpr QSizeF | boundedTo (const QSizeF &) const noexcept |
| Returns a size holding the minimum width and height of this size and the given otherSize.
|
|
constexpr QSizeF | grownBy (QMarginsF m) const noexcept |
|
constexpr QSizeF | shrunkBy (QMarginsF m) const noexcept |
|
constexpr qreal & | rwidth () noexcept |
| Returns a reference to the width.
|
|
constexpr qreal & | rheight () noexcept |
| Returns a reference to the height.
|
|
constexpr QSizeF & | operator+= (const QSizeF &) noexcept |
| Adds the given size to this size and returns a reference to this size.
|
|
constexpr QSizeF & | operator-= (const QSizeF &) noexcept |
| Subtracts the given size from this size and returns a reference to this size.
|
|
constexpr QSizeF & | operator*= (qreal c) noexcept |
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Multiplies both the width and height by the given finite factor and returns a reference to the size.
|
|
QSizeF & | operator/= (qreal c) |
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Divides both the width and height by the given divisor and returns a reference to the size.
|
|
constexpr QSize | toSize () const noexcept |
| Returns an integer based copy of this size.
|
|
|
QT_WARNING_PUSH QT_WARNING_DISABLE_FLOAT_COMPARE friend constexpr bool | qFuzzyCompare (const QSizeF &s1, const QSizeF &s2) noexcept |
|
QT_WARNING_POP friend constexpr bool | qFuzzyIsNull (const QSizeF &size) noexcept |
|
constexpr bool | comparesEqual (const QSizeF &lhs, const QSizeF &rhs) noexcept |
|
constexpr bool | comparesEqual (const QSizeF &lhs, const QSize &rhs) noexcept |
|
constexpr QSizeF | operator+ (const QSizeF &s1, const QSizeF &s2) noexcept |
| Returns the sum of s1 and s2; each component is added separately.
|
|
constexpr QSizeF | operator- (const QSizeF &s1, const QSizeF &s2) noexcept |
| Returns s2 subtracted from s1; each component is subtracted separately.
|
|
constexpr QSizeF | operator* (const QSizeF &s, qreal c) noexcept |
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Multiplies the given size by the given finite factor and returns the result.
|
|
constexpr QSizeF | operator* (qreal c, const QSizeF &s) noexcept |
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Multiplies the given size by the given finite factor and returns the result.
|
|
QSizeF | operator/ (const QSizeF &s, qreal c) |
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Divides the given size by the given divisor and returns the result.
|
|
template<std::size_t I, typename S , std::enable_if_t<(I< 2), bool > = true, std::enable_if_t< std::is_same_v< q20::remove_cvref_t< S >, QSizeF >, bool > = true> |
constexpr decltype(auto) | get (S &&s) noexcept |
|
\inmodule QtCore
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() 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, QRectF
Definition at line 207 of file qsize.h.