C
SizeF Class
class Qul::PlatformInterface::SizeFThe SizeF class defines the size of a two-dimensional object using floating point precision. More...
Header: | #include <platforminterface/size.h> |
Since: | Qt Quick Ultralite (Platform) 1.5 |
Public Functions
SizeF(float width, float height) | |
SizeF(const Qul::PlatformInterface::Size &size) | |
SizeF() | |
Qul::PlatformInterface::SizeF | boundedTo(const Qul::PlatformInterface::SizeF &otherSize) const |
Qul::PlatformInterface::SizeF | expandedTo(const Qul::PlatformInterface::SizeF &otherSize) const |
float | height() const |
bool | isEmpty() const |
bool | isNull() const |
bool | isValid() const |
void | setHeight(float height) |
void | setWidth(float width) |
Qul::PlatformInterface::Size | toSize() const |
Qul::PlatformInterface::SizeF | transposed() const |
float | width() const |
Qul::PlatformInterface::SizeF & | operator*=(float factor) |
Qul::PlatformInterface::SizeF & | operator+=(const Qul::PlatformInterface::SizeF &size) |
Qul::PlatformInterface::SizeF & | operator-=(const Qul::PlatformInterface::SizeF &size) |
Qul::PlatformInterface::SizeF & | 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. The SizeF class also provides the toSize() function returning a Size copy of this size, constructed by rounding the width and height to the nearest integers.
See also Qul::PlatformInterface::Size, Qul::PlatformInterface::PointF, and Qul::PlatformInterface::RectF.
Member Function Documentation
SizeF::SizeF(float width, float height)
Constructs a size with the given width and height.
SizeF::SizeF(const Qul::PlatformInterface::Size &size)
Constructs a size with floating point accuracy from the given size.
See also toSize().
SizeF::SizeF()
Constructs an invalid size.
See also isValid().
Qul::PlatformInterface::SizeF SizeF::boundedTo(const Qul::PlatformInterface::SizeF &otherSize) const
Returns a size holding the minimum width and height of this size and the given otherSize.
See also expandedTo().
Qul::PlatformInterface::SizeF SizeF::expandedTo(const Qul::PlatformInterface::SizeF &otherSize) const
Returns a size holding the maximum width and height of this size and the given otherSize.
See also boundedTo().
float SizeF::height() const
Returns the height.
See also width() and setHeight().
bool SizeF::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 SizeF::isNull() const
Returns true
if both the width and height are 0.0 (ignoring the sign); otherwise returns false
.
See also isValid() and isEmpty().
bool SizeF::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 SizeF::setHeight(float height)
Sets the height to the given height.
See also height() and setWidth().
void SizeF::setWidth(float width)
Sets the width to the given width.
See also width() and setHeight().
Qul::PlatformInterface::Size SizeF::toSize() const
Returns an integer based copy of this size.
Note that the coordinates in the returned size will be rounded to the nearest integer.
See also Qul::PlatformInterface::SizeF.
Qul::PlatformInterface::SizeF SizeF::transposed() const
Returns the size with width and height values swapped.
float SizeF::width() const
Returns the width.
See also height() and setWidth().
Qul::PlatformInterface::SizeF &SizeF::operator*=(float factor)
Multiplies both the width and height by the given factor and returns a reference to the size.
Qul::PlatformInterface::SizeF &SizeF::operator+=(const Qul::PlatformInterface::SizeF &size)
Adds the given size to this size and returns a reference to this size.
Qul::PlatformInterface::SizeF &SizeF::operator-=(const Qul::PlatformInterface::SizeF &size)
Subtracts the given size from this size and returns a reference to this size.
Qul::PlatformInterface::SizeF &SizeF::operator/=(float divisor)
Divides both the width and height by the given divisor and returns a reference to the size.
Available under certain Qt licenses.
Find out more.