QGIS API Documentation 3.41.0-Master (3440c17df1d)
Loading...
Searching...
No Matches
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
 
QgsLayoutPoint convert (const QgsLayoutPoint &point, Qgis::LayoutUnit targetUnits) const
 Converts a layout point from one unit to another.
 
QgsLayoutSize convert (const QgsLayoutSize &size, Qgis::LayoutUnit targetUnits) const
 Converts a layout size from one unit to another.
 
QgsLayoutMeasurement convert (QgsLayoutMeasurement measurement, Qgis::LayoutUnit targetUnits) const
 Converts a measurement from one unit to another.
 
double dpi () const
 Returns the Dots per inch (DPI) of the measurement converter.
 
void setDpi (const double dpi)
 Sets the dots per inch (dpi) for the measurement converter.
 

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

Definition at line 41 of file qgslayoutmeasurementconverter.h.

Constructor & Destructor Documentation

◆ QgsLayoutMeasurementConverter()

QgsLayoutMeasurementConverter::QgsLayoutMeasurementConverter ( )
default

Member Function Documentation

◆ convert() [1/3]

QgsLayoutPoint QgsLayoutMeasurementConverter::convert ( const QgsLayoutPoint point,
Qgis::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.

◆ convert() [2/3]

QgsLayoutSize QgsLayoutMeasurementConverter::convert ( const QgsLayoutSize size,
Qgis::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]

QgsLayoutMeasurement QgsLayoutMeasurementConverter::convert ( QgsLayoutMeasurement  measurement,
Qgis::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.

◆ 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 59 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 52 of file qgslayoutmeasurementconverter.h.


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