QGIS API Documentation 3.28.0-Firenze (ed3ad0430f)
|
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, QgsUnitTypes::LayoutUnit units=QgsUnitTypes::LayoutMillimeters) | |
Constructor for QgsLayoutSize. More... | |
QgsLayoutSize (QgsUnitTypes::LayoutUnit units=QgsUnitTypes::LayoutMillimeters) | |
Constructor for an empty layout size. More... | |
QgsLayoutSize (QSizeF size, QgsUnitTypes::LayoutUnit units=QgsUnitTypes::LayoutMillimeters) | |
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 QgsUnitTypes::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... | |
QgsUnitTypes::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, | ||
QgsUnitTypes::LayoutUnit | units = QgsUnitTypes::LayoutMillimeters |
||
) |
Constructor for QgsLayoutSize.
width | width |
height | height |
units | units for width and height |
Definition at line 22 of file qgslayoutsize.cpp.
|
explicit |
Constructor for QgsLayoutSize.
Definition at line 29 of file qgslayoutsize.cpp.
|
explicit |
Constructor for an empty layout size.
units | units for measurement |
Definition at line 36 of file qgslayoutsize.cpp.
|
static |
QString QgsLayoutSize::encodeSize | ( | ) | const |
Encodes the layout size to a string.
Definition at line 52 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 42 of file qgslayoutsize.cpp.
bool QgsLayoutSize::operator!= | ( | const QgsLayoutSize & | other | ) | const |
Definition at line 73 of file qgslayoutsize.cpp.
QgsLayoutSize QgsLayoutSize::operator* | ( | double | v | ) | const |
Multiplies the width and height by a scalar value.
Definition at line 78 of file qgslayoutsize.cpp.
QgsLayoutSize QgsLayoutSize::operator*= | ( | double | v | ) |
Multiplies the width and height by a scalar value.
Definition at line 83 of file qgslayoutsize.cpp.
QgsLayoutSize QgsLayoutSize::operator/ | ( | double | v | ) | const |
Divides the width and height by a scalar value.
Definition at line 89 of file qgslayoutsize.cpp.
QgsLayoutSize QgsLayoutSize::operator/= | ( | double | v | ) |
Divides the width and height by a scalar value.
Definition at line 94 of file qgslayoutsize.cpp.
bool QgsLayoutSize::operator== | ( | const QgsLayoutSize & | other | ) | const |
Definition at line 68 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 47 of file qgslayoutsize.cpp.
|
inline |
|
inline |
Returns the width of the size.
Definition at line 76 of file qgslayoutsize.h.