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.

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

decodeMeasurement

Decodes a measurement from a string.

encodeMeasurement

Encodes the layout measurement to a string

length

Returns the length of the measurement.

setLength

Sets the length of the measurement.

setUnits

Sets the units for the measurement.

units

Returns the units for the measurement.

decodeMeasurement(string: str) QgsLayoutMeasurement

Decodes a measurement from a string.

Parameters

string (str) –

Return type

QgsLayoutMeasurement

encodeMeasurement(self) str

Encodes the layout measurement to a string

Return type

str

length(self) float

Returns the length of the measurement.

See also

setLength()

Return type

float

setLength(self, length: float)

Sets the length of the measurement.

See also

length()

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

units()

Parameters

units (QgsUnitTypes.LayoutUnit) –

units(self) QgsUnitTypes.LayoutUnit

Returns the units for the measurement.

See also

setUnits()

Return type

QgsUnitTypes.LayoutUnit