Class: QgsProcessingParameterVolume

A double numeric parameter for volume values.

Linked to a source layer or CRS parameter to determine what units the volume values are in.

The number of decimals places shown in a volume parameter’s widget can be specified by setting the parameter’s metadata. For example:

param = QgsProcessingParameterVolume( 'VAL', 'Threshold')
# only show two decimal places in parameter's widgets, not 6:
param.setMetadata( {'widget_wrapper':
  { 'decimals': 2 }
})

Added in version 3.40.

Class Hierarchy

Inheritance diagram of qgis.core.QgsProcessingParameterVolume

Base classes

QgsProcessingParameterNumber

A numeric parameter for processing algorithms.

QgsProcessingParameterDefinition

Base class for the definition of processing parameters.

class qgis.core.QgsProcessingParameterVolume[source]

Bases: QgsProcessingParameterNumber

__init__(name: str | None, description: str | None = '', defaultValue: Any = None, parentParameterName: str | None = '', optional: bool = False, minValue: float = 0, maxValue: float = DBL_MAX)

Constructor for QgsProcessingParameterVolume.

Parameters:
  • name (Optional[str])

  • description (Optional[str] = '')

  • defaultValue (Any = None)

  • parentParameterName (Optional[str] = '')

  • optional (bool = False)

  • minValue (float = 0)

  • maxValue (float = DBL_MAX)

__init__(a0: QgsProcessingParameterVolume)
Parameters:

a0 (QgsProcessingParameterVolume)

defaultUnit(self) Qgis.VolumeUnit[source]

Returns the default volume unit for the parameter.

See also

setDefaultUnit()

Return type:

Qgis.VolumeUnit

parentParameterName(self) str[source]

Returns the name of the parent parameter, or an empty string if this is not set.

Return type:

str

setDefaultUnit(self, unit: Qgis.VolumeUnit)[source]

Sets the default volume unit for the parameter.

See also

defaultUnit()

Parameters:

unit (Qgis.VolumeUnit)

setParentParameterName(self, parentParameterName: str | None)[source]

Sets the name of the parent layer parameter. Use an empty string if this is not required.

Parameters:

parentParameterName (Optional[str])