QgsLayoutMeasurement class

This class provides a method of storing measurements for use in QGIS layouts using a variety of different measurement units.

Public static functions

static auto decodeMeasurement(const QString& string) -> QgsLayoutMeasurement
Decodes a measurement from a string.

Constructors, destructors, conversion operators

QgsLayoutMeasurement(double length, QgsUnitTypes::LayoutUnit units = QgsUnitTypes::LayoutMillimeters) explicit
Constructor for QgsLayoutMeasurement.

Public functions

auto encodeMeasurement() const -> QString
Encodes the layout measurement to a string.
auto length() const -> double
Returns the length of the measurement.
auto operator*(double v) const -> QgsLayoutMeasurement
Multiplies the measurement by a scalar value.
auto operator*=(double v) -> QgsLayoutMeasurement
Multiplies the measurement by a scalar value.
auto operator+(double v) const -> QgsLayoutMeasurement
Adds a scalar value to the measurement.
auto operator+=(double v) -> QgsLayoutMeasurement
Adds a scalar value to the measurement.
auto operator-(double v) const -> QgsLayoutMeasurement
Subtracts a scalar value from the measurement.
auto operator-=(double v) -> QgsLayoutMeasurement
Subtracts a scalar value from the measurement.
auto operator/(double v) const -> QgsLayoutMeasurement
Divides the measurement by a scalar value.
auto operator/=(double v) -> QgsLayoutMeasurement
Divides the measurement by a scalar value.
void setLength(const double length)
Sets the length of the measurement.
void setUnits(const QgsUnitTypes::LayoutUnit units)
Sets the units for the measurement.
auto units() const -> QgsUnitTypes::LayoutUnit
Returns the units for the measurement.

Function documentation

static QgsLayoutMeasurement QgsLayoutMeasurement::decodeMeasurement(const QString& string)

Decodes a measurement from a string.

QgsLayoutMeasurement::QgsLayoutMeasurement(double length, QgsUnitTypes::LayoutUnit units = QgsUnitTypes::LayoutMillimeters) explicit

Constructor for QgsLayoutMeasurement.

Parameters
length measurement length
units measurement units

QString QgsLayoutMeasurement::encodeMeasurement() const

Encodes the layout measurement to a string.

double QgsLayoutMeasurement::length() const

Returns the length of the measurement.

void QgsLayoutMeasurement::setLength(const double length)

Sets the length of the measurement.

void QgsLayoutMeasurement::setUnits(const QgsUnitTypes::LayoutUnit units)

Sets the units for the measurement.

Does not alter the stored length, ie. no length conversion is done.

QgsUnitTypes::LayoutUnit QgsLayoutMeasurement::units() const

Returns the units for the measurement.