Class: QgsLayoutMeasurement¶
- class qgis.core.QgsLayoutMeasurement¶
Bases:
sip.wrapper
This class provides a method of storing measurements for use in QGIS layouts using a variety of different measurement units.
See also
New in version 3.0.
QgsLayoutMeasurement(length: float, units: QgsUnitTypes.LayoutUnit = QgsUnitTypes.LayoutMillimeters) Constructor for QgsLayoutMeasurement.
- Parameters
length – measurement length
units – measurement units
QgsLayoutMeasurement(
QgsLayoutMeasurement
)Methods
Decodes a measurement from a
string
.Encodes the layout measurement to a string
Returns the length of the measurement.
Sets the
length
of the measurement.Sets the
units
for the measurement.Returns the units for the measurement.
- decodeMeasurement(string: str) QgsLayoutMeasurement ¶
Decodes a measurement from a
string
.See also
- Parameters
string (str) –
- Return type
- encodeMeasurement(self) str ¶
Encodes the layout measurement to a string
See also
- Return type
str
- length(self) float ¶
Returns the length of the measurement.
See also
- Return type
float
- setLength(self, length: float)¶
Sets the
length
of the measurement.See also
- Parameters
length (float) –
- setUnits(self, units: QgsUnitTypes.LayoutUnit)¶
Sets the
units
for the measurement. Does not alter the stored length, ie. no length conversion is done.See also
- Parameters
units (QgsUnitTypes.LayoutUnit) –
- units(self) QgsUnitTypes.LayoutUnit ¶
Returns the units for the measurement.
See also
- Return type