20 #include <QStringList> 35 QStringList parts =
string.split(
',' );
36 if ( parts.count() != 2 )
50 return ( !
operator==( other ) );
QgsUnitTypes::LayoutUnit units() const
Returns the units for the measurement.
QgsLayoutMeasurement operator-=(const double v)
Subtracts a scalar value from the measurement.
QgsLayoutMeasurement operator/=(const double v)
Divides the measurement by a scalar value.
bool operator==(const QgsLayoutMeasurement &other) const
QgsLayoutMeasurement operator-(const double v) const
Subtracts a scalar value from the measurement.
bool qgsDoubleNear(double a, double b, double epsilon=4 *DBL_EPSILON)
Compare two doubles (but allow some difference)
QgsLayoutMeasurement operator*(const double v) const
Multiplies the measurement by a scalar value.
This class provides a method of storing measurements for use in QGIS layouts using a variety of diffe...
static Q_INVOKABLE QgsUnitTypes::LayoutUnit decodeLayoutUnit(const QString &string, bool *ok=nullptr)
Decodes a layout unit from a string.
QgsLayoutMeasurement operator/(const double v) const
Divides the measurement by a scalar value.
QgsLayoutMeasurement operator+(const double v) const
Adds a scalar value to the measurement.
QgsLayoutMeasurement(const double length, const QgsUnitTypes::LayoutUnit units=QgsUnitTypes::LayoutMillimeters)
Constructor for QgsLayoutMeasurement.
bool operator!=(const QgsLayoutMeasurement &other) const
static Q_INVOKABLE QString encodeUnit(QgsUnitTypes::DistanceUnit unit)
Encodes a distance unit to a string.
static QgsLayoutMeasurement decodeMeasurement(const QString &string)
Decodes a measurement from a string.
QgsLayoutMeasurement operator+=(const double v)
Adds a scalar value to the measurement.
double length() const
Returns the length of the measurement.
LayoutUnit
Layout measurement units.
QString encodeMeasurement() const
Encodes the layout measurement to a string.
QgsLayoutMeasurement operator*=(const double v)
Multiplies the measurement by a scalar value.