Subgroup: Layout

Class: QgsLayoutMeasurement

class qgis.core.QgsLayoutMeasurement(length: float, units: QgsUnitTypes.LayoutUnit = QgsUnitTypes.LayoutMillimeters)

Bases: sip.wrapper

Constructor for QgsLayoutMeasurement.

Parameters:
  • length – measurement length
  • units – measurement units

QgsLayoutMeasurement(QgsLayoutMeasurement)

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: 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.

Signals

Attributes

decodeMeasurement(string: str) → QgsLayoutMeasurement

Decodes a measurement from a string.

encodeMeasurement(self) → str

Encodes the layout measurement to a string

length(self) → float

Returns the length of the measurement.

See also

setLength()

setLength(self, length: float)

Sets the length of the measurement.

See also

length()

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()

units(self) → QgsUnitTypes.LayoutUnit

Returns the units for the measurement.

See also

setUnits()