C
Size Class
class Qul::PlatformInterface::SizeThe Size class defines the size of a two-dimensional object using integer point precision. More...
Header: | #include <platforminterface/size.h> |
Since: | Qt Quick Ultralite (Platform) 1.5 |
Public Functions
Size(Qul::PlatformInterface::coord_t width, Qul::PlatformInterface::coord_t height) | |
Size() | |
Qul::PlatformInterface::Size | boundedTo(const Qul::PlatformInterface::Size &otherSize) const |
Qul::PlatformInterface::Size | expandedTo(const Qul::PlatformInterface::Size &otherSize) const |
Qul::PlatformInterface::coord_t | height() const |
bool | isEmpty() const |
bool | isNull() const |
bool | isValid() const |
void | setHeight(Qul::PlatformInterface::coord_t height) |
void | setWidth(Qul::PlatformInterface::coord_t width) |
Qul::PlatformInterface::Size | transposed() const |
Qul::PlatformInterface::coord_t | width() const |
Qul::PlatformInterface::Size & | operator*=(float factor) |
Qul::PlatformInterface::Size & | operator+=(const Qul::PlatformInterface::Size &size) |
Qul::PlatformInterface::Size & | operator-=(const Qul::PlatformInterface::Size &size) |
Qul::PlatformInterface::Size & | operator/=(float divisor) |
Detailed Description
A size is specified by a width() and a height(). It can be set in the constructor and changed using the setWidth() or setHeight() functions, or using arithmetic operators.
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. Size objects can be compared.
See also Qul::PlatformInterface::SizeF, Qul::PlatformInterface::Point, and Qul::PlatformInterface::Rect.
Member Function Documentation
Size::Size(Qul::PlatformInterface::coord_t width, Qul::PlatformInterface::coord_t height)
Constructs a size with the given width and height.
See also setWidth() and setHeight().
Size::Size()
Constructs a size with an invalid width and height (i.e., isValid() returns false
).
See also isValid().
Qul::PlatformInterface::Size Size::boundedTo(const Qul::PlatformInterface::Size &otherSize) const
Returns a size holding the minimum width and height of this size and the given otherSize.
See also expandedTo().
Qul::PlatformInterface::Size Size::expandedTo(const Qul::PlatformInterface::Size &otherSize) const
Returns a size holding the maximum width and height of this size and the given otherSize.
See also boundedTo().
Qul::PlatformInterface::coord_t Size::height() const
Returns the height.
See also width() and setHeight().
bool Size::isEmpty() const
Returns true
if either of the width and height is less than or equal to 0; otherwise returns false
.
See also isNull() and isValid().
bool Size::isNull() const
Returns true
if both the width and height is 0; otherwise returns false.
See also isValid() and isEmpty().
bool Size::isValid() const
Returns true
if both the width and height is equal to or greater than 0; otherwise returns false
.
See also isNull() and isEmpty().
void Size::setHeight(Qul::PlatformInterface::coord_t height)
Sets the height to the given height.
See also height() and setWidth().
void Size::setWidth(Qul::PlatformInterface::coord_t width)
Sets the width to the given width.
See also width() and setHeight().
Qul::PlatformInterface::Size Size::transposed() const
Returns a Size with width and height swapped.
Qul::PlatformInterface::coord_t Size::width() const
Returns the width.
See also height() and setWidth().
Qul::PlatformInterface::Size &Size::operator*=(float factor)
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.
Qul::PlatformInterface::Size &Size::operator+=(const Qul::PlatformInterface::Size &size)
Adds the given size to this size, and returns a reference to this size.
Qul::PlatformInterface::Size &Size::operator-=(const Qul::PlatformInterface::Size &size)
Subtracts the given size from this size, and returns a reference to this size.
Qul::PlatformInterface::Size &Size::operator/=(float divisor)
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.
Available under certain Qt licenses.
Find out more.