|
constexpr | QSize () noexcept |
| Constructs a size with an invalid width and height (i.e., isValid() returns false ).
|
|
constexpr | QSize (int w, int h) noexcept |
| Constructs a size with the given width and height.
|
|
constexpr bool | isNull () const noexcept |
| Returns true if both the width and height is 0; 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 is equal to or greater than 0; otherwise returns false .
|
|
constexpr int | width () const noexcept |
| Returns the width.
|
|
constexpr int | height () const noexcept |
| Returns the height.
|
|
constexpr void | setWidth (int w) noexcept |
| Sets the width to the given width.
|
|
constexpr void | setHeight (int h) noexcept |
| Sets the height to the given height.
|
|
void | transpose () noexcept |
| Swaps the width and height values.
|
|
constexpr QSize | transposed () const noexcept |
|
void | scale (int w, int 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 QSize &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.
|
|
QSize | scaled (int w, int h, Qt::AspectRatioMode mode) const noexcept |
|
QSize | scaled (const QSize &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 QSize | expandedTo (const QSize &) const noexcept |
| Returns a size holding the maximum width and height of this size and the given otherSize.
|
|
constexpr QSize | boundedTo (const QSize &) const noexcept |
| Returns a size holding the minimum width and height of this size and the given otherSize.
|
|
constexpr QSize | grownBy (QMargins m) const noexcept |
|
constexpr QSize | shrunkBy (QMargins m) const noexcept |
|
constexpr int & | rwidth () noexcept |
| Returns a reference to the width.
|
|
constexpr int & | rheight () noexcept |
| Returns a reference to the height.
|
|
constexpr QSize & | operator+= (const QSize &) noexcept |
| Adds the given size to this size, and returns a reference to this size.
|
|
constexpr QSize & | operator-= (const QSize &) noexcept |
| Subtracts the given size from this size, and returns a reference to this size.
|
|
constexpr QSize & | 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 factor, and returns a reference to the size.
|
|
QSize & | 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 QSizeF | toSizeF () const noexcept |
|
|
constexpr bool | comparesEqual (const QSize &s1, const QSize &s2) noexcept |
|
constexpr QSize | operator+ (const QSize &s1, const QSize &s2) noexcept |
| Returns the sum of s1 and s2; each component is added separately.
|
|
constexpr QSize | operator- (const QSize &s1, const QSize &s2) noexcept |
| Returns s2 subtracted from s1; each component is subtracted separately.
|
|
constexpr QSize | operator* (const QSize &s, qreal c) noexcept |
| Multiplies the given size by the given factor, and returns the result rounded to the nearest integer.
|
|
constexpr QSize | operator* (qreal c, const QSize &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 factor, and returns the result rounded to the nearest integer.
|
|
QSize | operator/ (const QSize &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 rounded to the nearest integer.
|
|
constexpr size_t | qHash (const QSize &s, size_t seed=0) |
|
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 >, QSize >, bool > = true> |
constexpr decltype(auto) | get (S &&s) noexcept |
|
\inmodule QtCore
The QSize class defines the size of a two-dimensional object using integer 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.
QSize objects can be streamed as well as compared.
- See also
- QSizeF, QPoint, QRect
Definition at line 25 of file qsize.h.