CopperSpice API
1.9.2
|
Defines the size of a two-dimensional object using integer point precision. More...
Public Methods | |
constexpr | QSize () |
constexpr | QSize (int width, int height) |
QSize | boundedTo (const QSize &other) const |
QSize | expandedTo (const QSize &other) const |
constexpr int | height () const |
constexpr bool | isEmpty () const |
constexpr bool | isNull () const |
constexpr bool | isValid () const |
QSize & | operator*= (qreal factor) |
QSize & | operator+= (const QSize &size) |
QSize & | operator-= (const QSize &size) |
QSize & | operator/= (qreal factor) |
int & | rheight () |
int & | rwidth () |
void | scale (const QSize &size, Qt::AspectRatioMode mode) |
void | scale (int width, int height, Qt::AspectRatioMode mode) |
QSize | scaled (const QSize &size, Qt::AspectRatioMode mode) const |
QSize | scaled (int width, int height, Qt::AspectRatioMode mode) const |
void | setHeight (int height) |
void | setWidth (int width) |
void | transpose () |
QSize | transposed () const |
constexpr int | width () const |
Friends | |
bool | operator!= (const QSize &size1, const QSize &size2) |
const QSize | operator* (const QSize &size, qreal factor) |
const QSize | operator* (qreal factor, const QSize &size) |
const QSize | operator+ (const QSize &size1, const QSize &size2) |
const QSize | operator- (const QSize &size1, const QSize &size2) |
const QSize | operator/ (const QSize &size, qreal factor) |
bool | operator== (const QSize &size1, const QSize &size2) |
Related Functions | |
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.
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 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.
|
inlineconstexpr |
|
inlineconstexpr |
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.
|
inlineconstexpr |
Returns the height.
|
inlineconstexpr |
|
inlineconstexpr |
|
inlineconstexpr |
|
inline |
Multiplies both the width and height by the given factor and returns a reference to the size. The result is rounded to the nearest integer.
|
inline |
|
inline |
|
inline |
Divides both the width and height by the given factor and returns a reference to the size. The result is rounded to the nearest integer.
|
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.
QSize QSize::scaled | ( | const QSize & | size, |
Qt::AspectRatioMode | mode | ||
) | const |
Return a size scaled to a rectangle with the given size, according to the specified mode.
|
inline |
Return 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.
void QSize::transpose | ( | ) |
Swaps the width and height values.
|
inline |
Returns a QSize with width and height swapped.
|
inlineconstexpr |
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 rounded to the nearest integer.
|
friend |
Multiplies the given size by the given factor and returns the result rounded to the nearest integer.
|
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 rounded to the nearest integer.
|
related |
Writes the given size to the stream. 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 the given size. Returns a reference to the stream.
Refer to Serializing Data Types for additional information.