QtBase
v6.3.1
|
The QSizeF class defines the size of a two-dimensional object using floating point precision. More...
#include <qsize.h>
Public Member Functions | |
constexpr | QSizeF () noexcept |
constexpr | QSizeF (const QSize &sz) noexcept |
constexpr | QSizeF (qreal w, qreal h) noexcept |
bool | isNull () const noexcept |
constexpr bool | isEmpty () const noexcept |
constexpr bool | isValid () const noexcept |
constexpr qreal | width () const noexcept |
constexpr qreal | height () const noexcept |
constexpr void | setWidth (qreal w) noexcept |
constexpr void | setHeight (qreal h) noexcept |
void | transpose () noexcept |
constexpr QSizeF | transposed () const noexcept |
void | scale (qreal w, qreal h, Qt::AspectRatioMode mode) noexcept |
void | scale (const QSizeF &s, Qt::AspectRatioMode mode) noexcept |
QSizeF | scaled (qreal w, qreal h, Qt::AspectRatioMode mode) const noexcept |
QSizeF | scaled (const QSizeF &s, Qt::AspectRatioMode mode) const noexcept |
constexpr QSizeF | expandedTo (const QSizeF &) const noexcept |
constexpr QSizeF | boundedTo (const QSizeF &) const noexcept |
constexpr QSizeF | grownBy (QMarginsF m) const noexcept |
constexpr QSizeF | shrunkBy (QMarginsF m) const noexcept |
constexpr qreal & | rwidth () noexcept |
constexpr qreal & | rheight () noexcept |
constexpr QSizeF & | operator+= (const QSizeF &) noexcept |
constexpr QSizeF & | operator-= (const QSizeF &) noexcept |
constexpr QSizeF & | operator*= (qreal c) noexcept |
QSizeF & | operator/= (qreal c) |
constexpr QSize | toSize () const noexcept |
Friends | |
QT_WARNING_PUSH QT_WARNING_DISABLE_FLOAT_COMPARE constexpr friend bool | operator== (const QSizeF &s1, const QSizeF &s2) |
QT_WARNING_POP constexpr friend bool | operator!= (const QSizeF &s1, const QSizeF &s2) |
constexpr friend QSizeF | operator+ (const QSizeF &s1, const QSizeF &s2) noexcept |
constexpr friend QSizeF | operator- (const QSizeF &s1, const QSizeF &s2) noexcept |
constexpr friend QSizeF | operator* (const QSizeF &s, qreal c) noexcept |
constexpr friend QSizeF | operator* (qreal c, const QSizeF &s) noexcept |
QSizeF | operator/ (const QSizeF &s, qreal c) |
Related Functions | |
(Note that these are not member functions.) | |
QDataStream & | operator<< (QDataStream &stream, const QSizeF &size) |
QDataStream & | operator>> (QDataStream &stream, QSizeF &size) |
The QSizeF class defines the size of a two-dimensional object using floating 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.
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.
|
inlineconstexprnoexcept |
Returns a size holding the minimum width and height of this size and the given otherSize.
Definition at line 413 of file qsize.h.
Returns a size holding the maximum width and height of this size and the given otherSize.
|
inlineconstexprnoexcept |
Returns the height.
Definition at line 352 of file qsize.h.
|
inlineconstexprnoexcept |
|
inlinenoexcept |
|
inlineconstexprnoexcept |
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. The divisor must not be either zero or NaN.
Definition at line 400 of file qsize.h.
|
inlineconstexprnoexcept |
Returns a reference to the height.
Using a reference makes it possible to manipulate the height directly. For example:
|
inlineconstexprnoexcept |
Returns a reference to the width.
Using a reference makes it possible to manipulate the width directly. For example:
|
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 367 of file qsize.h.
|
inlinenoexcept |
Scales the size to a rectangle with the given width and height, according to the specified mode.
\list
Example:
|
noexcept |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Returns a size scaled to a rectangle with the given size s, according to the specified mode.
Definition at line 667 of file qsize.cpp.
|
inlinenoexcept |
Sets the height to the given finite height.
Definition at line 358 of file qsize.h.
Sets the width to the given finite width.
Definition at line 355 of file qsize.h.
|
inlineconstexprnoexcept |
|
noexcept |
Swaps the width and height values.
Definition at line 608 of file qsize.cpp.
|
inlineconstexprnoexcept |
Returns the size with width and height values swapped.
Definition at line 361 of file qsize.h.
|
inlineconstexprnoexcept |
Returns the width.
Definition at line 349 of file qsize.h.
|
friend |
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.
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. The divisor must not be either zero or NaN.
|
related |
Returns true
if s1 and s2 are approximately equal; otherwise returns false.
|
related |