Subgroup: Layout

Class: QgsLayoutMeasurementConverter

class qgis.core.QgsLayoutMeasurementConverter

Bases: sip.wrapper

Constructor for QgsLayoutMeasurementConverter.

QgsLayoutMeasurementConverter(QgsLayoutMeasurementConverter)

This class provides a method of converting QgsLayoutMeasurements from one unit to another. Conversion to or from pixel units utilizes a specified dots per inch (DPI) property for the converter. Converters default to using 300 DPI.

New in version 3.0: Methods

convert Converts a measurement from one unit to another.
dpi Returns the Dots per inch (DPI) of the measurement converter.
setDpi Sets the dots per inch (dpi) for the measurement converter.

Signals

Attributes

convert(self, measurement: QgsLayoutMeasurement, targetUnits: QgsUnitTypes.LayoutUnit) → QgsLayoutMeasurement

Converts a measurement from one unit to another.

Parameters:
  • measurement – measurement to convert
  • targetUnits – units to convert measurement into
Returns:

measurement converted to target units

convert(self, size: QgsLayoutSize, targetUnits: QgsUnitTypes.LayoutUnit) -> QgsLayoutSize Converts a layout size from one unit to another.

Parameters:
  • size – layout size to convert
  • targetUnits – units to convert size into
Returns:

size converted to target units

convert(self, point: QgsLayoutPoint, targetUnits: QgsUnitTypes.LayoutUnit) -> QgsLayoutPoint Converts a layout point from one unit to another.

Parameters:
  • point – layout point to convert
  • targetUnits – units to convert point into
Returns:

point converted to target units

dpi(self) → float

Returns the Dots per inch (DPI) of the measurement converter. This is used when converting measurements to and from pixels.

See also

setDpi()

setDpi(self, dpi: float)

Sets the dots per inch (dpi) for the measurement converter. This is used when converting measurements to and from pixels.

See also

dpi()