QGIS API Documentation  3.9.0-Master (224899f119)
Public Member Functions | List of all members
QgsLayoutMeasurementConverter Class Reference

This class provides a method of converting QgsLayoutMeasurements from one unit to another. More...

#include <qgslayoutmeasurementconverter.h>

Public Member Functions

 QgsLayoutMeasurementConverter ()=default
 Constructor for QgsLayoutMeasurementConverter. More...
 
QgsLayoutMeasurement convert (QgsLayoutMeasurement measurement, QgsUnitTypes::LayoutUnit targetUnits) const
 Converts a measurement from one unit to another. More...
 
QgsLayoutSize convert (const QgsLayoutSize &size, QgsUnitTypes::LayoutUnit targetUnits) const
 Converts a layout size from one unit to another. More...
 
QgsLayoutPoint convert (const QgsLayoutPoint &point, QgsUnitTypes::LayoutUnit targetUnits) const
 Converts a layout point from one unit to another. More...
 
double dpi () const
 Returns the Dots per inch (DPI) of the measurement converter. More...
 
void setDpi (const double dpi)
 Sets the dots per inch (dpi) for the measurement converter. More...
 

Detailed Description

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.

See also
QgsLayoutMeasurement
Since
QGIS 3.0

Definition at line 40 of file qgslayoutmeasurementconverter.h.

Constructor & Destructor Documentation

◆ QgsLayoutMeasurementConverter()

QgsLayoutMeasurementConverter::QgsLayoutMeasurementConverter ( )
default

Member Function Documentation

◆ convert() [1/3]

QgsLayoutMeasurement QgsLayoutMeasurementConverter::convert ( QgsLayoutMeasurement  measurement,
QgsUnitTypes::LayoutUnit  targetUnits 
) const

Converts a measurement from one unit to another.

Parameters
measurementmeasurement to convert
targetUnitsunits to convert measurement into
Returns
measurement converted to target units

Definition at line 21 of file qgslayoutmeasurementconverter.cpp.

◆ convert() [2/3]

QgsLayoutSize QgsLayoutMeasurementConverter::convert ( const QgsLayoutSize size,
QgsUnitTypes::LayoutUnit  targetUnits 
) const

Converts a layout size from one unit to another.

Parameters
sizelayout size to convert
targetUnitsunits to convert size into
Returns
size converted to target units

Definition at line 52 of file qgslayoutmeasurementconverter.cpp.

◆ convert() [3/3]

QgsLayoutPoint QgsLayoutMeasurementConverter::convert ( const QgsLayoutPoint point,
QgsUnitTypes::LayoutUnit  targetUnits 
) const

Converts a layout point from one unit to another.

Parameters
pointlayout point to convert
targetUnitsunits to convert point into
Returns
point converted to target units

Definition at line 93 of file qgslayoutmeasurementconverter.cpp.

◆ dpi()

double QgsLayoutMeasurementConverter::dpi ( ) const
inline

Returns the Dots per inch (DPI) of the measurement converter.

This is used when converting measurements to and from pixels.

See also
setDpi()

Definition at line 61 of file qgslayoutmeasurementconverter.h.

◆ setDpi()

void QgsLayoutMeasurementConverter::setDpi ( const double  dpi)
inline

Sets the dots per inch (dpi) for the measurement converter.

This is used when converting measurements to and from pixels.

See also
dpi()

Definition at line 54 of file qgslayoutmeasurementconverter.h.


The documentation for this class was generated from the following files: