QGIS API Documentation 3.32.0-Lima (311a8cb8a6)
Classes | Public Types | Static Public Member Functions | List of all members
QgsUnitTypes Class Reference

Helper functions for various unit types. More...

#include <qgsunittypes.h>

Classes

struct  AreaValue
 A combination of area value and unit. More...
 
struct  DistanceValue
 A combination of distance value and unit. More...
 

Public Types

typedef QList< Qgis::RenderUnitRenderUnitList
 List of render units. More...
 

Static Public Member Functions

static Q_INVOKABLE Qgis::DistanceUnit areaToDistanceUnit (Qgis::AreaUnit areaUnit)
 Converts an area unit to its corresponding distance unit, e.g., square meters to meters. More...
 
static Q_INVOKABLE Qgis::AngleUnit decodeAngleUnit (const QString &string, bool *ok=nullptr)
 Decodes an angular unit from a string. More...
 
static Q_INVOKABLE Qgis::AreaUnit decodeAreaUnit (const QString &string, bool *ok=nullptr)
 Decodes an areal unit from a string. More...
 
static Q_INVOKABLE Qgis::DistanceUnit decodeDistanceUnit (const QString &string, bool *ok=nullptr)
 Decodes a distance unit from a string. More...
 
static Q_INVOKABLE Qgis::LayoutUnit decodeLayoutUnit (const QString &string, bool *ok=nullptr)
 Decodes a layout unit from a string. More...
 
static Q_INVOKABLE Qgis::RenderUnit decodeRenderUnit (const QString &string, bool *ok=nullptr)
 Decodes a render unit from a string. More...
 
static Q_INVOKABLE Qgis::TemporalUnit decodeTemporalUnit (const QString &string, bool *ok=nullptr)
 Decodes a temporal unit from a string. More...
 
static Q_INVOKABLE Qgis::UnitType decodeUnitType (const QString &string, bool *ok=nullptr)
 Decodes a unit type from a string. More...
 
static Q_INVOKABLE Qgis::VolumeUnit decodeVolumeUnit (const QString &string, bool *ok=nullptr)
 Decodes a volume unit from a string. More...
 
static Q_INVOKABLE Qgis::AreaUnit distanceToAreaUnit (Qgis::DistanceUnit distanceUnit)
 Converts a distance unit to its corresponding area unit, e.g., meters to square meters. More...
 
static Q_INVOKABLE Qgis::VolumeUnit distanceToVolumeUnit (Qgis::DistanceUnit distanceUnit)
 Converts a distance unit to its corresponding volume unit, e.g., meters to cubic meters. More...
 
static QString encodeUnit (Qgis::AngleUnit unit)
 Encodes an angular unit to a string. More...
 
static QString encodeUnit (Qgis::AreaUnit unit)
 Encodes an areal unit to a string. More...
 
static Q_INVOKABLE QString encodeUnit (Qgis::DistanceUnit unit)
 Encodes a distance unit to a string. More...
 
static QString encodeUnit (Qgis::LayoutUnit unit)
 Encodes a layout unit to a string. More...
 
static QString encodeUnit (Qgis::RenderUnit unit)
 Encodes a render unit to a string. More...
 
static QString encodeUnit (Qgis::TemporalUnit unit)
 Encodes a temporal unit to a string. More...
 
static QString encodeUnit (Qgis::VolumeUnit unit)
 Encodes a volume unit to a string. More...
 
static Q_INVOKABLE QString encodeUnitType (Qgis::UnitType type)
 Encodes a unit type to a string. More...
 
static Q_INVOKABLE QString formatAngle (double angle, int decimals, Qgis::AngleUnit unit)
 Returns an angle formatted as a friendly string. More...
 
static Q_INVOKABLE QString formatArea (double area, int decimals, Qgis::AreaUnit unit, bool keepBaseUnit=false)
 Returns an area formatted as a friendly string. More...
 
static Q_INVOKABLE QString formatDistance (double distance, int decimals, Qgis::DistanceUnit unit, bool keepBaseUnit=false)
 Returns an distance formatted as a friendly string. More...
 
static double fromUnitToUnitFactor (Qgis::AngleUnit fromUnit, Qgis::AngleUnit toUnit)
 Returns the conversion factor between the specified angular units. More...
 
static double fromUnitToUnitFactor (Qgis::AreaUnit fromUnit, Qgis::AreaUnit toUnit)
 Returns the conversion factor between the specified areal units. More...
 
static Q_INVOKABLE double fromUnitToUnitFactor (Qgis::DistanceUnit fromUnit, Qgis::DistanceUnit toUnit)
 Returns the conversion factor between the specified distance units. More...
 
static double fromUnitToUnitFactor (Qgis::TemporalUnit fromUnit, Qgis::TemporalUnit toUnit)
 Returns the conversion factor between the specified temporal units. More...
 
static double fromUnitToUnitFactor (Qgis::VolumeUnit fromUnit, Qgis::VolumeUnit toUnit)
 Returns the conversion factor between the specified volume units. More...
 
static Q_INVOKABLE QgsUnitTypes::AreaValue scaledArea (double area, Qgis::AreaUnit unit, int decimals, bool keepBaseUnit=false)
 Will convert an area with a given unit to an area value which is nice to display. More...
 
static Q_INVOKABLE QgsUnitTypes::DistanceValue scaledDistance (double distance, Qgis::DistanceUnit unit, int decimals, bool keepBaseUnit=false)
 Will convert a distance with a given unit to a distance value which is nice to display. More...
 
static Q_INVOKABLE Qgis::AreaUnit stringToAreaUnit (const QString &string, bool *ok=nullptr)
 Converts a translated string to an areal unit. More...
 
static Q_INVOKABLE Qgis::DistanceUnit stringToDistanceUnit (const QString &string, bool *ok=nullptr)
 Converts a translated string to a distance unit. More...
 
static Q_INVOKABLE Qgis::TemporalUnit stringToTemporalUnit (const QString &string, bool *ok=nullptr)
 Converts a translated string to a temporal unit. More...
 
static Q_INVOKABLE Qgis::VolumeUnit stringToVolumeUnit (const QString &string, bool *ok=nullptr)
 Converts a translated string to a volume unit. More...
 
static QString toAbbreviatedString (Qgis::AreaUnit unit)
 Returns a translated abbreviation representing an areal unit. More...
 
static Q_INVOKABLE QString toAbbreviatedString (Qgis::DistanceUnit unit)
 Returns a translated abbreviation representing a distance unit. More...
 
static QString toAbbreviatedString (Qgis::LayoutUnit unit)
 Returns a translated abbreviation representing a layout unit (e.g. More...
 
static QString toAbbreviatedString (Qgis::RenderUnit unit)
 Returns a translated abbreviation representing a render unit. More...
 
static QString toAbbreviatedString (Qgis::TemporalUnit unit)
 Returns a translated abbreviation representing a temporal unit. More...
 
static QString toAbbreviatedString (Qgis::VolumeUnit unit)
 Returns a translated abbreviation representing a volume unit. More...
 
static QString toString (Qgis::AngleUnit unit)
 Returns a translated string representing an angular unit. More...
 
static QString toString (Qgis::AreaUnit unit)
 Returns a translated string representing an areal unit. More...
 
static Q_INVOKABLE QString toString (Qgis::DistanceUnit unit)
 Returns a translated string representing a distance unit. More...
 
static QString toString (Qgis::LayoutUnit unit)
 Returns a translated string representing a layout unit. More...
 
static QString toString (Qgis::RenderUnit unit)
 Returns a translated string representing a render unit. More...
 
static QString toString (Qgis::TemporalUnit unit)
 Returns a translated string representing a temporal unit. More...
 
static QString toString (Qgis::VolumeUnit unit)
 Returns a translated string representing a volume unit. More...
 
static Qgis::DistanceUnitType unitType (Qgis::AreaUnit unit)
 Returns the type for an areal unit. More...
 
static Q_INVOKABLE Qgis::DistanceUnitType unitType (Qgis::DistanceUnit unit)
 Returns the type for a distance unit. More...
 
static Q_INVOKABLE Qgis::LayoutUnitType unitType (Qgis::LayoutUnit units)
 Returns the type for a unit of measurement. More...
 
static Qgis::DistanceUnitType unitType (Qgis::VolumeUnit unit)
 Returns the type for an volume unit. More...
 
static Q_INVOKABLE Qgis::DistanceUnit volumeToDistanceUnit (Qgis::VolumeUnit volumeUnit)
 Converts a volume unit to its corresponding distance unit, e.g., cubic meters to meters. More...
 

Detailed Description

Helper functions for various unit types.

Since
QGIS 2.14

Definition at line 39 of file qgsunittypes.h.

Member Typedef Documentation

◆ RenderUnitList

List of render units.

Definition at line 84 of file qgsunittypes.h.

Member Function Documentation

◆ areaToDistanceUnit()

Qgis::DistanceUnit QgsUnitTypes::areaToDistanceUnit ( Qgis::AreaUnit  areaUnit)
static

Converts an area unit to its corresponding distance unit, e.g., square meters to meters.

Parameters
areaUnitarea unit to convert
Returns
matching distance unit
Since
QGIS 3.10

Definition at line 1350 of file qgsunittypes.cpp.

◆ decodeAngleUnit()

Qgis::AngleUnit QgsUnitTypes::decodeAngleUnit ( const QString &  string,
bool *  ok = nullptr 
)
static

Decodes an angular unit from a string.

Parameters
stringstring to decode
okoptional boolean, will be set to true if string was converted successfully
Returns
decoded units
See also
encodeUnit()

Definition at line 2410 of file qgsunittypes.cpp.

◆ decodeAreaUnit()

Qgis::AreaUnit QgsUnitTypes::decodeAreaUnit ( const QString &  string,
bool *  ok = nullptr 
)
static

Decodes an areal unit from a string.

Parameters
stringstring to decode
okoptional boolean, will be set to true if string was converted successfully
Returns
decoded units
See also
encodeUnit()

Definition at line 725 of file qgsunittypes.cpp.

◆ decodeDistanceUnit()

Qgis::DistanceUnit QgsUnitTypes::decodeDistanceUnit ( const QString &  string,
bool *  ok = nullptr 
)
static

Decodes a distance unit from a string.

Parameters
stringstring to decode
okoptional boolean, will be set to true if string was converted successfully
Returns
decoded units
See also
encodeUnit()

Definition at line 170 of file qgsunittypes.cpp.

◆ decodeLayoutUnit()

Qgis::LayoutUnit QgsUnitTypes::decodeLayoutUnit ( const QString &  string,
bool *  ok = nullptr 
)
static

Decodes a layout unit from a string.

Parameters
stringstring to decode
okoptional boolean, will be set to true if string was converted successfully
Returns
decoded units
See also
encodeUnit()
Since
QGIS 3.0

Definition at line 3192 of file qgsunittypes.cpp.

◆ decodeRenderUnit()

Qgis::RenderUnit QgsUnitTypes::decodeRenderUnit ( const QString &  string,
bool *  ok = nullptr 
)
static

Decodes a render unit from a string.

Parameters
stringstring to decode
okoptional boolean, will be set to true if string was converted successfully
Returns
decoded units
See also
encodeUnit()

Definition at line 3097 of file qgsunittypes.cpp.

◆ decodeTemporalUnit()

Qgis::TemporalUnit QgsUnitTypes::decodeTemporalUnit ( const QString &  string,
bool *  ok = nullptr 
)
static

Decodes a temporal unit from a string.

Parameters
stringstring to decode
okoptional boolean, will be set to true if string was converted successfully
Returns
decoded units
See also
encodeUnit()
Since
QGIS 3.14

Definition at line 1425 of file qgsunittypes.cpp.

◆ decodeUnitType()

Qgis::UnitType QgsUnitTypes::decodeUnitType ( const QString &  string,
bool *  ok = nullptr 
)
static

Decodes a unit type from a string.

Parameters
stringstring to decode
okoptional boolean, will be set to true if string was converted successfully
Returns
decoded unit type
See also
encodeUnitType()
Since
QGIS 3.10

Definition at line 49 of file qgsunittypes.cpp.

◆ decodeVolumeUnit()

Qgis::VolumeUnit QgsUnitTypes::decodeVolumeUnit ( const QString &  string,
bool *  ok = nullptr 
)
static

Decodes a volume unit from a string.

Parameters
stringstring to decode
okoptional boolean, will be set to true if string was converted successfully
Returns
decoded units
See also
encodeUnit()
Since
QGIS 3.10

Definition at line 1880 of file qgsunittypes.cpp.

◆ distanceToAreaUnit()

Qgis::AreaUnit QgsUnitTypes::distanceToAreaUnit ( Qgis::DistanceUnit  distanceUnit)
static

Converts a distance unit to its corresponding area unit, e.g., meters to square meters.

Parameters
distanceUnitdistance unit to convert
Returns
matching areal unit

Definition at line 1309 of file qgsunittypes.cpp.

◆ distanceToVolumeUnit()

Qgis::VolumeUnit QgsUnitTypes::distanceToVolumeUnit ( Qgis::DistanceUnit  distanceUnit)
static

Converts a distance unit to its corresponding volume unit, e.g., meters to cubic meters.

Parameters
distanceUnitdistance unit to convert
Returns
matching volume unit
Since
QGIS 3.10

Definition at line 2261 of file qgsunittypes.cpp.

◆ encodeUnit() [1/7]

QString QgsUnitTypes::encodeUnit ( Qgis::AngleUnit  unit)
static

Encodes an angular unit to a string.

Parameters
unitunit to encode
Returns
encoded string
See also
decodeAngleUnit()

Definition at line 2384 of file qgsunittypes.cpp.

◆ encodeUnit() [2/7]

QString QgsUnitTypes::encodeUnit ( Qgis::AreaUnit  unit)
static

Encodes an areal unit to a string.

Parameters
unitunit to encode
Returns
encoded string
See also
decodeAreaUnit()

Definition at line 691 of file qgsunittypes.cpp.

◆ encodeUnit() [3/7]

QString QgsUnitTypes::encodeUnit ( Qgis::DistanceUnit  unit)
static

Encodes a distance unit to a string.

Parameters
unitunit to encode
Returns
encoded string
See also
decodeDistanceUnit()

Definition at line 124 of file qgsunittypes.cpp.

◆ encodeUnit() [4/7]

QString QgsUnitTypes::encodeUnit ( Qgis::LayoutUnit  unit)
static

Encodes a layout unit to a string.

Parameters
unitunit to encode
Returns
encoded string
See also
decodeLayoutUnit()
Since
QGIS 3.0

Definition at line 3168 of file qgsunittypes.cpp.

◆ encodeUnit() [5/7]

QString QgsUnitTypes::encodeUnit ( Qgis::RenderUnit  unit)
static

Encodes a render unit to a string.

Parameters
unitunit to encode
Returns
encoded string
See also
decodeRenderUnit()

Definition at line 3073 of file qgsunittypes.cpp.

◆ encodeUnit() [6/7]

QString QgsUnitTypes::encodeUnit ( Qgis::TemporalUnit  unit)
static

Encodes a temporal unit to a string.

Returns
encoded string
See also
decodeTemporalUnit()
Since
QGIS 3.14

Definition at line 1393 of file qgsunittypes.cpp.

◆ encodeUnit() [7/7]

QString QgsUnitTypes::encodeUnit ( Qgis::VolumeUnit  unit)
static

Encodes a volume unit to a string.

Returns
encoded string
See also
decodeVolumeUnit()
Since
QGIS 3.10

Definition at line 2354 of file qgsunittypes.cpp.

◆ encodeUnitType()

QString QgsUnitTypes::encodeUnitType ( Qgis::UnitType  type)
static

Encodes a unit type to a string.

Returns
encoded string
See also
decodeUnitType()
Since
QGIS 3.10

Definition at line 26 of file qgsunittypes.cpp.

◆ formatAngle()

QString QgsUnitTypes::formatAngle ( double  angle,
int  decimals,
Qgis::AngleUnit  unit 
)
static

Returns an angle formatted as a friendly string.

Parameters
angleangle to format
decimalsnumber of decimal places to show. A value of -1 indicates that an appropriate number of decimal places should automatically be selected.
unitunit of angle
Returns
formatted angle string

Definition at line 2680 of file qgsunittypes.cpp.

◆ formatArea()

QString QgsUnitTypes::formatArea ( double  area,
int  decimals,
Qgis::AreaUnit  unit,
bool  keepBaseUnit = false 
)
static

Returns an area formatted as a friendly string.

Parameters
areaarea to format
decimalsnumber of decimal places to show
unitunit of area
keepBaseUnitset to false to allow conversion of large areas to more suitable units, e.g., square meters to square kilometers
Returns
formatted area string
See also
formatDistance()
Since
QGIS 3.0

Definition at line 3053 of file qgsunittypes.cpp.

◆ formatDistance()

QString QgsUnitTypes::formatDistance ( double  distance,
int  decimals,
Qgis::DistanceUnit  unit,
bool  keepBaseUnit = false 
)
static

Returns an distance formatted as a friendly string.

Parameters
distancedistance to format
decimalsnumber of decimal places to show
unitunit of distance
keepBaseUnitset to false to allow conversion of large distances to more suitable units, e.g., meters to kilometers
Returns
formatted distance string
See also
formatArea()
Since
QGIS 3.0

Definition at line 3033 of file qgsunittypes.cpp.

◆ fromUnitToUnitFactor() [1/5]

double QgsUnitTypes::fromUnitToUnitFactor ( Qgis::AngleUnit  fromUnit,
Qgis::AngleUnit  toUnit 
)
static

Returns the conversion factor between the specified angular units.

Parameters
fromUnitangle unit to convert from
toUnitangle unit to convert to
Returns
multiplication factor to convert between units

Definition at line 2467 of file qgsunittypes.cpp.

◆ fromUnitToUnitFactor() [2/5]

double QgsUnitTypes::fromUnitToUnitFactor ( Qgis::AreaUnit  fromUnit,
Qgis::AreaUnit  toUnit 
)
static

Returns the conversion factor between the specified areal units.

Parameters
fromUnitarea unit to convert from
toUnitarea unit to convert to
Returns
multiplication factor to convert between units

Definition at line 872 of file qgsunittypes.cpp.

◆ fromUnitToUnitFactor() [3/5]

double QgsUnitTypes::fromUnitToUnitFactor ( Qgis::DistanceUnit  fromUnit,
Qgis::DistanceUnit  toUnit 
)
static

Returns the conversion factor between the specified distance units.

Parameters
fromUnitdistance unit to convert from
toUnitdistance unit to convert to
Returns
multiplication factor to convert between units

Definition at line 367 of file qgsunittypes.cpp.

◆ fromUnitToUnitFactor() [4/5]

double QgsUnitTypes::fromUnitToUnitFactor ( Qgis::TemporalUnit  fromUnit,
Qgis::TemporalUnit  toUnit 
)
static

Returns the conversion factor between the specified temporal units.

Note
Conversion to or from month units assumes a 30 day month length.
Conversion to or from year based units assumes a 365.25 day year length.
Parameters
fromUnittemporal unit to convert from
toUnittemporal unit to convert to
Returns
multiplication factor to convert between units
Since
QGIS 3.14

Definition at line 1565 of file qgsunittypes.cpp.

◆ fromUnitToUnitFactor() [5/5]

double QgsUnitTypes::fromUnitToUnitFactor ( Qgis::VolumeUnit  fromUnit,
Qgis::VolumeUnit  toUnit 
)
static

Returns the conversion factor between the specified volume units.

Parameters
fromUnitvolume unit to convert from
toUnitvolume unit to convert to
Returns
multiplication factor to convert between units
Since
QGIS 3.10

Definition at line 2014 of file qgsunittypes.cpp.

◆ scaledArea()

QgsUnitTypes::AreaValue QgsUnitTypes::scaledArea ( double  area,
Qgis::AreaUnit  unit,
int  decimals,
bool  keepBaseUnit = false 
)
static

Will convert an area with a given unit to an area value which is nice to display.

It will convert between different units (e.g. from square meters to square kilometers) if appropriate, unless forced otherwise with keepBaseUnit. The value will also be rounded to decimals (be prepared that the returned value is still a double so it will require further formatting when converting to a string).

Since
QGIS 3.0

Definition at line 2840 of file qgsunittypes.cpp.

◆ scaledDistance()

QgsUnitTypes::DistanceValue QgsUnitTypes::scaledDistance ( double  distance,
Qgis::DistanceUnit  unit,
int  decimals,
bool  keepBaseUnit = false 
)
static

Will convert a distance with a given unit to a distance value which is nice to display.

It will convert between different units (e.g. from meters to kilometers or millimeters) if appropriate, unless forced otherwise with keepBaseUnit. The value will also be rounded to decimals (be prepared that the returned value is still a double so it will require further formatting when converting to a string).

Since
QGIS 3.0

Definition at line 2729 of file qgsunittypes.cpp.

◆ stringToAreaUnit()

Qgis::AreaUnit QgsUnitTypes::stringToAreaUnit ( const QString &  string,
bool *  ok = nullptr 
)
static

Converts a translated string to an areal unit.

Parameters
stringstring representing an areal unit
okoptional boolean, will be set to true if string was converted successfully
Returns
the area unit
See also
toString()

Definition at line 833 of file qgsunittypes.cpp.

◆ stringToDistanceUnit()

Qgis::DistanceUnit QgsUnitTypes::stringToDistanceUnit ( const QString &  string,
bool *  ok = nullptr 
)
static

Converts a translated string to a distance unit.

Parameters
stringstring representing a distance unit
okoptional boolean, will be set to true if string was converted successfully
Returns
the distance unit
See also
toString()

Definition at line 325 of file qgsunittypes.cpp.

◆ stringToTemporalUnit()

Qgis::TemporalUnit QgsUnitTypes::stringToTemporalUnit ( const QString &  string,
bool *  ok = nullptr 
)
static

Converts a translated string to a temporal unit.

Parameters
stringstring representing a volume unit
okoptional boolean, will be set to true if string was converted successfully
Returns
the temporal unit
See also
toString()
Since
QGIS 3.14

Definition at line 1527 of file qgsunittypes.cpp.

◆ stringToVolumeUnit()

Qgis::VolumeUnit QgsUnitTypes::stringToVolumeUnit ( const QString &  string,
bool *  ok = nullptr 
)
static

Converts a translated string to a volume unit.

Parameters
stringstring representing a volume unit
okoptional boolean, will be set to true if string was converted successfully
Returns
the volume unit
See also
toString()
Since
QGIS 3.10

Definition at line 1977 of file qgsunittypes.cpp.

◆ toAbbreviatedString() [1/6]

QString QgsUnitTypes::toAbbreviatedString ( Qgis::AreaUnit  unit)
static

Returns a translated abbreviation representing an areal unit.

Parameters
unitunit to convert to string
See also
stringToAreaUnit()
Since
QGIS 3.0

Definition at line 799 of file qgsunittypes.cpp.

◆ toAbbreviatedString() [2/6]

QString QgsUnitTypes::toAbbreviatedString ( Qgis::DistanceUnit  unit)
static

Returns a translated abbreviation representing a distance unit.

Parameters
unitunit to convert to string
See also
stringToDistanceUnit()
Since
QGIS 3.0

Definition at line 279 of file qgsunittypes.cpp.

◆ toAbbreviatedString() [3/6]

QString QgsUnitTypes::toAbbreviatedString ( Qgis::LayoutUnit  unit)
static

Returns a translated abbreviation representing a layout unit (e.g.

"mm").

Since
QGIS 3.0

Definition at line 3243 of file qgsunittypes.cpp.

◆ toAbbreviatedString() [4/6]

QString QgsUnitTypes::toAbbreviatedString ( Qgis::RenderUnit  unit)
static

Returns a translated abbreviation representing a render unit.

Parameters
unitunit to convert to string
Since
QGIS 3.8

Definition at line 246 of file qgsunittypes.cpp.

◆ toAbbreviatedString() [5/6]

QString QgsUnitTypes::toAbbreviatedString ( Qgis::TemporalUnit  unit)
static

Returns a translated abbreviation representing a temporal unit.

See also
stringToTemporalUnit()
Since
QGIS 3.14

Definition at line 1495 of file qgsunittypes.cpp.

◆ toAbbreviatedString() [6/6]

QString QgsUnitTypes::toAbbreviatedString ( Qgis::VolumeUnit  unit)
static

Returns a translated abbreviation representing a volume unit.

See also
stringToVolumeUnit()
Since
QGIS 3.10

Definition at line 1946 of file qgsunittypes.cpp.

◆ toString() [1/7]

QString QgsUnitTypes::toString ( Qgis::AngleUnit  unit)
static

Returns a translated string representing an angular unit.

Parameters
unitunit to convert to string

Definition at line 2441 of file qgsunittypes.cpp.

◆ toString() [2/7]

QString QgsUnitTypes::toString ( Qgis::AreaUnit  unit)
static

Returns a translated string representing an areal unit.

Parameters
unitunit to convert to string
See also
stringToAreaUnit()

Definition at line 765 of file qgsunittypes.cpp.

◆ toString() [3/7]

QString QgsUnitTypes::toString ( Qgis::DistanceUnit  unit)
static

Returns a translated string representing a distance unit.

Parameters
unitunit to convert to string
See also
stringToDistanceUnit()

Definition at line 206 of file qgsunittypes.cpp.

◆ toString() [4/7]

QString QgsUnitTypes::toString ( Qgis::LayoutUnit  unit)
static

Returns a translated string representing a layout unit.

Since
QGIS 3.0

Definition at line 3267 of file qgsunittypes.cpp.

◆ toString() [5/7]

QString QgsUnitTypes::toString ( Qgis::RenderUnit  unit)
static

Returns a translated string representing a render unit.

Since
QGIS 3.0

Definition at line 3134 of file qgsunittypes.cpp.

◆ toString() [6/7]

QString QgsUnitTypes::toString ( Qgis::TemporalUnit  unit)
static

Returns a translated string representing a temporal unit.

See also
stringToTemporalUnit()
Since
QGIS 3.14

Definition at line 1463 of file qgsunittypes.cpp.

◆ toString() [7/7]

QString QgsUnitTypes::toString ( Qgis::VolumeUnit  unit)
static

Returns a translated string representing a volume unit.

See also
stringToVolumeUnit()
Since
QGIS 3.10

Definition at line 1916 of file qgsunittypes.cpp.

◆ unitType() [1/4]

Qgis::DistanceUnitType QgsUnitTypes::unitType ( Qgis::AreaUnit  unit)
static

Returns the type for an areal unit.

Definition at line 97 of file qgsunittypes.cpp.

◆ unitType() [2/4]

Qgis::DistanceUnitType QgsUnitTypes::unitType ( Qgis::DistanceUnit  unit)
static

Returns the type for a distance unit.

Definition at line 73 of file qgsunittypes.cpp.

◆ unitType() [3/4]

Qgis::LayoutUnitType QgsUnitTypes::unitType ( Qgis::LayoutUnit  units)
static

Returns the type for a unit of measurement.

Since
QGIS 3.0

Definition at line 3223 of file qgsunittypes.cpp.

◆ unitType() [4/4]

Qgis::DistanceUnitType QgsUnitTypes::unitType ( Qgis::VolumeUnit  unit)
static

Returns the type for an volume unit.

Since
QGIS 3.10

Definition at line 2332 of file qgsunittypes.cpp.

◆ volumeToDistanceUnit()

Qgis::DistanceUnit QgsUnitTypes::volumeToDistanceUnit ( Qgis::VolumeUnit  volumeUnit)
static

Converts a volume unit to its corresponding distance unit, e.g., cubic meters to meters.

Parameters
volumeUnitvolume unit to convert
Returns
matching distance unit
Since
QGIS 3.10

Definition at line 2302 of file qgsunittypes.cpp.


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