Class: QgsLayoutMeasurementConverter

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.

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.

class qgis.core.QgsLayoutMeasurementConverter[source]

Bases: object

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

Converts a measurement from one unit to another.

Parameters:
Return type:

QgsLayoutMeasurement

Returns:

measurement converted to target units

convert(self, size: QgsLayoutSize, targetUnits: Qgis.LayoutUnit) QgsLayoutSize[source]

Converts a layout size from one unit to another.

Parameters:
Return type:

QgsLayoutSize

Returns:

size converted to target units

convert(self, point: QgsLayoutPoint, targetUnits: Qgis.LayoutUnit) QgsLayoutPoint[source]

Converts a layout point from one unit to another.

Parameters:
Return type:

QgsLayoutPoint

Returns:

point converted to target units

dpi(self) float[source]

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)[source]

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)