QGIS API Documentation 3.41.0-Master (3440c17df1d)
|
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. | |
QgsLayoutSize (Qgis::LayoutUnit units=Qgis::LayoutUnit::Millimeters) | |
Constructor for an empty layout size. | |
QgsLayoutSize (QSizeF size, Qgis::LayoutUnit units=Qgis::LayoutUnit::Millimeters) | |
Constructor for QgsLayoutSize. | |
QString | encodeSize () const |
Encodes the layout size to a string. | |
double | height () const |
Returns the height of the size. | |
bool | isEmpty () const |
Tests whether the size is empty, ie both its width and height are zero. | |
bool | operator!= (const QgsLayoutSize &other) const |
QgsLayoutSize | operator* (double v) const |
Multiplies the width and height by a scalar value. | |
QgsLayoutSize | operator*= (double v) |
Multiplies the width and height by a scalar value. | |
QgsLayoutSize | operator/ (double v) const |
Divides the width and height by a scalar value. | |
QgsLayoutSize | operator/= (double v) |
Divides the width and height by a scalar value. | |
bool | operator== (const QgsLayoutSize &other) const |
void | setHeight (const double height) |
Sets the height for the size. | |
void | setSize (const double width, const double height) |
Sets new width and height for the size. | |
void | setUnits (const Qgis::LayoutUnit units) |
Sets the units for the size. | |
void | setWidth (const double width) |
Sets the width for the size. | |
QSizeF | toQSizeF () const |
Converts the layout size to a QSizeF. | |
Qgis::LayoutUnit | units () const |
Returns the units for the size. | |
double | width () const |
Returns the width of the size. | |
Static Public Member Functions | |
static QgsLayoutSize | decodeSize (const QString &string) |
Decodes a size from a string. | |
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 33 of file qgslayoutsize.cpp.
|
explicit |
Constructor for an empty layout size.
units | units for measurement |
Definition at line 40 of file qgslayoutsize.cpp.
|
static |
QString QgsLayoutSize::encodeSize | ( | ) | const |
Encodes the layout size to a string.
Definition at line 56 of file qgslayoutsize.cpp.
|
inline |
Returns the height of the size.
Definition at line 103 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 46 of file qgslayoutsize.cpp.
bool QgsLayoutSize::operator!= | ( | const QgsLayoutSize & | other | ) | const |
Definition at line 82 of file qgslayoutsize.cpp.
QgsLayoutSize QgsLayoutSize::operator* | ( | double | v | ) | const |
Multiplies the width and height by a scalar value.
Definition at line 87 of file qgslayoutsize.cpp.
QgsLayoutSize QgsLayoutSize::operator*= | ( | double | v | ) |
Multiplies the width and height by a scalar value.
Definition at line 92 of file qgslayoutsize.cpp.
QgsLayoutSize QgsLayoutSize::operator/ | ( | double | v | ) | const |
Divides the width and height by a scalar value.
Definition at line 98 of file qgslayoutsize.cpp.
QgsLayoutSize QgsLayoutSize::operator/= | ( | double | v | ) |
Divides the width and height by a scalar value.
Definition at line 103 of file qgslayoutsize.cpp.
bool QgsLayoutSize::operator== | ( | const QgsLayoutSize & | other | ) | const |
Definition at line 77 of file qgslayoutsize.cpp.
|
inline |
Sets the height for the size.
Definition at line 110 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 129 of file qgslayoutsize.h.
|
inline |
Sets the width for the size.
Definition at line 90 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 51 of file qgslayoutsize.cpp.
|
inline |
|
inline |
Returns the width of the size.
Definition at line 83 of file qgslayoutsize.h.