QtBase
v6.3.1
|
The QSize class defines the size of a two-dimensional object using integer point precision. More...
#include <qsize.h>
Public Member Functions | |
constexpr | QSize () noexcept |
constexpr | QSize (int w, int h) noexcept |
constexpr bool | isNull () const noexcept |
constexpr bool | isEmpty () const noexcept |
constexpr bool | isValid () const noexcept |
constexpr int | width () const noexcept |
constexpr int | height () const noexcept |
constexpr void | setWidth (int w) noexcept |
constexpr void | setHeight (int h) noexcept |
void | transpose () noexcept |
constexpr QSize | transposed () const noexcept |
void | scale (int w, int h, Qt::AspectRatioMode mode) noexcept |
void | scale (const QSize &s, Qt::AspectRatioMode mode) noexcept |
QSize | scaled (int w, int h, Qt::AspectRatioMode mode) const noexcept |
QSize | scaled (const QSize &s, Qt::AspectRatioMode mode) const noexcept |
constexpr QSize | expandedTo (const QSize &) const noexcept |
constexpr QSize | boundedTo (const QSize &) const noexcept |
constexpr QSize | grownBy (QMargins m) const noexcept |
constexpr QSize | shrunkBy (QMargins m) const noexcept |
constexpr int & | rwidth () noexcept |
constexpr int & | rheight () noexcept |
constexpr QSize & | operator+= (const QSize &) noexcept |
constexpr QSize & | operator-= (const QSize &) noexcept |
constexpr QSize & | operator*= (qreal c) noexcept |
QSize & | operator/= (qreal c) |
Friends | |
constexpr friend bool | operator== (const QSize &s1, const QSize &s2) noexcept |
constexpr friend bool | operator!= (const QSize &s1, const QSize &s2) noexcept |
constexpr friend QSize | operator+ (const QSize &s1, const QSize &s2) noexcept |
constexpr friend QSize | operator- (const QSize &s1, const QSize &s2) noexcept |
constexpr friend QSize | operator* (const QSize &s, qreal c) noexcept |
constexpr friend QSize | operator* (qreal c, const QSize &s) noexcept |
QSize | operator/ (const QSize &s, qreal c) |
constexpr friend size_t | qHash (const QSize &, size_t) noexcept |
Related Functions | |
(Note that these are not member functions.) | |
QDataStream & | operator<< (QDataStream &stream, const QSize &size) |
QDataStream & | operator>> (QDataStream &stream, QSize &size) |
The QSize class defines the size of a two-dimensional object using integer point precision.
\inmodule QtCore
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.
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
Constructs a size with the given width and height.
Returns a size holding the minimum width and height of this size and the given otherSize.
Definition at line 224 of file qsize.h.
Returns a size holding the maximum width and height of this size and the given otherSize.
Definition at line 219 of file qsize.h.
|
inlineconstexprnoexcept |
Returns the height.
Definition at line 160 of file qsize.h.
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
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.
Note that the result is rounded to the nearest integer.
Definition at line 201 of file qsize.h.
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.
Note that the result is rounded to the nearest integer.
Definition at line 211 of file qsize.h.
|
inlineconstexprnoexcept |
Returns a reference to the height.
Using a reference makes it possible to manipulate the height directly. For example:
Definition at line 184 of file qsize.h.
|
inlineconstexprnoexcept |
Returns a reference to the width.
Using a reference makes it possible to manipulate the width directly. For example:
Definition at line 181 of file qsize.h.
|
inlinenoexcept |
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.
Definition at line 175 of file qsize.h.
|
inlinenoexcept |
Scales the size to a rectangle with the given width and height, according to the specified mode:
\list
Example:
Definition at line 172 of file qsize.h.
|
noexcept |
|
inlinenoexcept |
|
inlineconstexprnoexcept |
Sets the height to the given height.
Definition at line 166 of file qsize.h.
|
inlineconstexprnoexcept |
Sets the width to the given width.
Definition at line 163 of file qsize.h.
|
noexcept |
Swaps the width and height values.
Definition at line 166 of file qsize.cpp.
|
inlineconstexprnoexcept |
Returns a QSize with width and height swapped.
Definition at line 169 of file qsize.h.
|
inlineconstexprnoexcept |
Returns the width.
Definition at line 157 of file qsize.h.
|
friend |
Multiplies the given size by the given factor, and returns the result rounded to the nearest integer.
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.
|
related |
|
related |