This class defines the size of a two-dimensional object. More...
#include <Nimble/Size.hpp>
Public Member Functions | |
| SizeT | boundedTo (const SizeT &size) const |
| Returns a size holding the minimum width and height of this and the given size. More... | |
| template<typename S > | |
| Nimble::SizeT< S > | cast () const |
| Cast the vector to another type. | |
| template<typename S > | |
| SizeT< S > | cast () const |
| SizeT | expandedTo (const SizeT &size) const |
| Returns a size holding the maximum width and height of this and the given size. More... | |
| void | fit (T width, T height, Qt::AspectRatioMode mode) |
| Fits the size to the given size. More... | |
| void | fit (const SizeT &size, Qt::AspectRatioMode mode) |
| Fits the size to the given size. More... | |
| T | height () const |
| Get the height. More... | |
| bool | isEmpty () const |
| Check if the size is empty. More... | |
| bool | isNull () const |
| Check if the size is zero. More... | |
| bool | isValid () const |
| Check if the size is invalid. More... | |
| void | make (T width, T height) |
| Set the width and height of the size. More... | |
| T | maximum () const |
| T | minimum () const |
| bool | operator!= (const SizeT< T > &o) const |
| Compare if two sizes are not equal. More... | |
| SizeT< T > | operator+ (const SizeT< T > &o) const |
| Return the sum of two sizes. More... | |
| SizeT< T > & | operator+= (const SizeT< T > &s) |
| Add the given size to this size. More... | |
| SizeT< T > | operator- (const SizeT< T > &o) const |
| Return the subtraction of two sizes. More... | |
| SizeT< T > & | operator-= (const SizeT< T > &s) |
| Subtract the given size from this size. More... | |
| bool | operator== (const SizeT< T > &o) const |
| Compare if two sizes are equal. More... | |
| T | operator[] (int index) const |
| Index an element in the size object. More... | |
| void | setHeight (T height) |
| Set the height of the size. More... | |
| void | setWidth (T width) |
| Set the width of the size. More... | |
| SizeT () | |
| Constructs a size with invalid width and height (i.e. isValid() returns false) | |
| SizeT (const Nimble::Vector2T< T > &v) | |
| Construct a size defined by a 2D vector. More... | |
| SizeT (T width, T height) | |
| Constructs a size with the given width and height. More... | |
| SizeT (const SizeT &other) | |
| Copy constructor. | |
| Vector2T< T > | toVector () const |
| Convert the size to a vector. More... | |
| void | transpose () |
| Transpose the size, i.e. swap the width and height. | |
| T | width () const |
| Get the width. More... | |
This class defines the size of a two-dimensional object.
|
explicit |
Construct a size defined by a 2D vector.
| v | vector whose components define the size |
| Nimble::SizeT< T >::SizeT | ( | T | width, |
| T | height | ||
| ) |
Constructs a size with the given width and height.
| width | width to initialize the size to |
| height | height to initialize the size to |
| SizeT< T > Nimble::SizeT< T >::boundedTo | ( | const SizeT< T > & | size | ) | const |
Returns a size holding the minimum width and height of this and the given size.
| size | size to compare to |
| SizeT< T > Nimble::SizeT< T >::expandedTo | ( | const SizeT< T > & | size | ) | const |
Returns a size holding the maximum width and height of this and the given size.
| size | size to compare to |
| void Nimble::SizeT< T >::fit | ( | T | width, |
| T | height, | ||
| Qt::AspectRatioMode | mode | ||
| ) |
Fits the size to the given size.
| width | width to fit to |
| height | height to fit to |
| mode | either Qt::IgnoreAspectRatio or Qt::KeepAspectRatio |
| void Nimble::SizeT< T >::fit | ( | const SizeT< T > & | size, |
| Qt::AspectRatioMode | mode | ||
| ) |
Fits the size to the given size.
| size | size to fit to |
| mode | either Qt::IgnoreAspectRatio or Qt::KeepAspectRatio |
|
inline |
Get the height.
| bool Nimble::SizeT< T >::isEmpty | ( | ) | const |
Check if the size is empty.
| bool Nimble::SizeT< T >::isNull | ( | ) | const |
Check if the size is zero.
| bool Nimble::SizeT< T >::isValid | ( | ) | const |
Check if the size is invalid.
| void Nimble::SizeT< T >::make | ( | T | width, |
| T | height | ||
| ) |
Set the width and height of the size.
| width,height | new width and height |
| T Nimble::SizeT< T >::maximum | ( | ) | const |
| T Nimble::SizeT< T >::minimum | ( | ) | const |
| bool Nimble::SizeT< T >::operator!= | ( | const SizeT< T > & | o | ) | const |
Compare if two sizes are not equal.
| o | size to compare |
| SizeT< T > Nimble::SizeT< T >::operator+ | ( | const SizeT< T > & | o | ) | const |
Return the sum of two sizes.
Each component is added separately.
| o | size to add |
| SizeT< T > & Nimble::SizeT< T >::operator+= | ( | const SizeT< T > & | s | ) |
Add the given size to this size.
| s | size to add |
| SizeT< T > Nimble::SizeT< T >::operator- | ( | const SizeT< T > & | o | ) | const |
Return the subtraction of two sizes.
Each component is subtracted separately.
| o | size to add |
| SizeT< T > & Nimble::SizeT< T >::operator-= | ( | const SizeT< T > & | s | ) |
Subtract the given size from this size.
| s | size to subtract |
| bool Nimble::SizeT< T >::operator== | ( | const SizeT< T > & | o | ) | const |
Compare if two sizes are equal.
| o | size to compare |
|
inline |
Index an element in the size object.
This method does not check that the argument value is valid
| void Nimble::SizeT< T >::setHeight | ( | T | height | ) |
Set the height of the size.
| height | new height |
| void Nimble::SizeT< T >::setWidth | ( | T | width | ) |
Set the width of the size.
| width | new width |
| Vector2T< T > Nimble::SizeT< T >::toVector | ( | ) | const |
Convert the size to a vector.
|
inline |
Get the width.