QSize Class
The QSize class defines the size of a two-dimensional object using integer point precision. More...
Header: | #include <QSize> |
qmake: | QT += core |
Public Functions
QSize | scaled(const QSize &s, Qt::AspectRatioMode mode) const |
CGSize | toCGSize() const |
void | transpose() |
Related Non-Members
bool | operator!=(const int &s1, const int &s2) |
bool | operator==(const int &s1, const int &s2) |
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.
QSize objects can be streamed as well as compared.
See also QSizeF, QPoint, and QRect.
Member Function Documentation
QSize QSize::scaled(const QSize &s, Qt::AspectRatioMode mode) const
This is an overloaded function.
Return 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 QSize::toCGSize() const
Creates a CGSize from a QSize.
This function was introduced in Qt 5.8.
See also QSizeF::fromCGSize().
void QSize::transpose()
Swaps the width and height values.
See also setWidth(), setHeight(), and transposed().
Related Non-Members
bool QSize::operator!=(const int &s1, const int &s2)
Returns true
if the pointer referenced by ptr1 is not the same pointer as that referenced by ptr2.
If ptr2's template parameter is different from ptr1's, QSharedPointer will attempt to perform an automatic static_cast
to ensure that the pointers being compared are equal. If ptr2's template parameter is not a base or a derived type from ptr1's, you will get a compiler error.
This function was introduced in Qt 5.0.
bool QSize::operator==(const int &s1, const int &s2)
Returns true
if the pointer referenced by ptr1 is the same pointer as that referenced by ptr2.
If ptr2's template parameter is different from ptr1's, QSharedPointer will attempt to perform an automatic static_cast
to ensure that the pointers being compared are equal. If ptr2's template parameter is not a base or a derived type from ptr1's, you will get a compiler error.
This function was introduced in Qt 5.0.