QGIS API Documentation 3.30.0-'s-Hertogenbosch (f186b8efe0)
|
This class provides a method of storing sizes, consisting of a width and height, for use in QGIS layouts. More...
#include <qgslayoutsize.h>
Public Member Functions | |
QgsLayoutSize (double width, double height, Qgis::LayoutUnit units=Qgis::LayoutUnit::Millimeters) | |
Constructor for QgsLayoutSize. More... | |
QgsLayoutSize (Qgis::LayoutUnit units=Qgis::LayoutUnit::Millimeters) | |
Constructor for an empty layout size. More... | |
QgsLayoutSize (QSizeF size, Qgis::LayoutUnit units=Qgis::LayoutUnit::Millimeters) | |
Constructor for QgsLayoutSize. More... | |
QString | encodeSize () const |
Encodes the layout size to a string. More... | |
double | height () const |
Returns the height of the size. More... | |
bool | isEmpty () const |
Tests whether the size is empty, ie both its width and height are zero. More... | |
bool | operator!= (const QgsLayoutSize &other) const |
QgsLayoutSize | operator* (double v) const |
Multiplies the width and height by a scalar value. More... | |
QgsLayoutSize | operator*= (double v) |
Multiplies the width and height by a scalar value. More... | |
QgsLayoutSize | operator/ (double v) const |
Divides the width and height by a scalar value. More... | |
QgsLayoutSize | operator/= (double v) |
Divides the width and height by a scalar value. More... | |
bool | operator== (const QgsLayoutSize &other) const |
void | setHeight (const double height) |
Sets the height for the size. More... | |
void | setSize (const double width, const double height) |
Sets new width and height for the size. More... | |
void | setUnits (const Qgis::LayoutUnit units) |
Sets the units for the size. More... | |
void | setWidth (const double width) |
Sets the width for the size. More... | |
QSizeF | toQSizeF () const |
Converts the layout size to a QSizeF. More... | |
Qgis::LayoutUnit | units () const |
Returns the units for the size. More... | |
double | width () const |
Returns the width of the size. More... | |
Static Public Member Functions | |
static QgsLayoutSize | decodeSize (const QString &string) |
Decodes a size from a string. More... | |
This class provides a method of storing sizes, consisting of a width and height, for use in QGIS layouts.
Measurement units are stored alongside the size.
Definition at line 40 of file qgslayoutsize.h.
QgsLayoutSize::QgsLayoutSize | ( | double | width, |
double | height, | ||
Qgis::LayoutUnit | units = Qgis::LayoutUnit::Millimeters |
||
) |
Constructor for QgsLayoutSize.
width | width |
height | height |
units | units for width and height |
Definition at line 23 of file qgslayoutsize.cpp.
|
explicit |
Constructor for QgsLayoutSize.
Definition at line 30 of file qgslayoutsize.cpp.
|
explicit |
Constructor for an empty layout size.
units | units for measurement |
Definition at line 37 of file qgslayoutsize.cpp.
|
static |
QString QgsLayoutSize::encodeSize | ( | ) | const |
Encodes the layout size to a string.
Definition at line 53 of file qgslayoutsize.cpp.
|
inline |
Returns the height of the size.
Definition at line 90 of file qgslayoutsize.h.
bool QgsLayoutSize::isEmpty | ( | ) | const |
Tests whether the size is empty, ie both its width and height are zero.
true
if size is empty Definition at line 43 of file qgslayoutsize.cpp.
bool QgsLayoutSize::operator!= | ( | const QgsLayoutSize & | other | ) | const |
Definition at line 74 of file qgslayoutsize.cpp.
QgsLayoutSize QgsLayoutSize::operator* | ( | double | v | ) | const |
Multiplies the width and height by a scalar value.
Definition at line 79 of file qgslayoutsize.cpp.
QgsLayoutSize QgsLayoutSize::operator*= | ( | double | v | ) |
Multiplies the width and height by a scalar value.
Definition at line 84 of file qgslayoutsize.cpp.
QgsLayoutSize QgsLayoutSize::operator/ | ( | double | v | ) | const |
Divides the width and height by a scalar value.
Definition at line 90 of file qgslayoutsize.cpp.
QgsLayoutSize QgsLayoutSize::operator/= | ( | double | v | ) |
Divides the width and height by a scalar value.
Definition at line 95 of file qgslayoutsize.cpp.
bool QgsLayoutSize::operator== | ( | const QgsLayoutSize & | other | ) | const |
Definition at line 69 of file qgslayoutsize.cpp.
|
inline |
Sets the height for the size.
Definition at line 97 of file qgslayoutsize.h.
|
inline |
Sets new width and height for the size.
Definition at line 69 of file qgslayoutsize.h.
|
inline |
Sets the units for the size.
Does not alter the stored width or height, ie. no conversion is done.
Definition at line 110 of file qgslayoutsize.h.
|
inline |
Sets the width for the size.
Definition at line 83 of file qgslayoutsize.h.
QSizeF QgsLayoutSize::toQSizeF | ( | ) | const |
Converts the layout size to a QSizeF.
The unit information is discarded during this operation.
Definition at line 48 of file qgslayoutsize.cpp.
|
inline |
|
inline |
Returns the width of the size.
Definition at line 76 of file qgslayoutsize.h.