Class: QgsLayoutMeasurementConverter

class qgis.core.QgsLayoutMeasurementConverter

Bases: sip.wrapper

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.

QgsLayoutMeasurementConverter() Constructor for QgsLayoutMeasurementConverter.

QgsLayoutMeasurementConverter(QgsLayoutMeasurementConverter)

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.

convert(self, measurement: QgsLayoutMeasurement, targetUnits: Qgis.LayoutUnit) QgsLayoutMeasurement

Converts a measurement from one unit to another.

Parameters:
Returns:

measurement converted to target units

convert(self, size: QgsLayoutSize, targetUnits: Qgis.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: Qgis.LayoutUnit) -> QgsLayoutPoint Converts a layout point from one unit to another.

Parameters:
  • point – layout point to convert

  • targetUnits – units to convert point into

Return type:

QgsLayoutMeasurement

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

Return type:

float

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

Parameters:

dpi (float) –