Class: QgsProcessingParameterDistance

class qgis.core.QgsProcessingParameterDistance(name: str, description: str = '', defaultValue: Any = None, parentParameterName: str = '', optional: bool = False, minValue: float = -DBL_MAX+1, maxValue: float = DBL_MAX)

Bases: qgis._core.QgsProcessingParameterNumber

Constructor for QgsProcessingParameterDistance.

QgsProcessingParameterDistance(QgsProcessingParameterDistance)

A double numeric parameter for distance values. Linked to a source layer or CRS parameter to determine what units the distance values are in.

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

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

New in version 3.2: Enums

Methods

asPythonString

clone

defaultUnit

Returns the default distance unit for the parameter.

dependsOnOtherParameters

fromVariantMap

parentParameterName

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

setDefaultUnit

Sets the default distance unit for the parameter.

setParentParameterName

Sets the name of the parent layer parameter.

toVariantMap

type

typeName

Returns the type name for the parameter class.

Signals

Attributes

asPythonString(self, outputType: QgsProcessing.PythonOutputType = QgsProcessing.PythonQgsProcessingAlgorithmSubclass) → str
clone(self) → QgsProcessingParameterDistance
defaultUnit(self) → QgsUnitTypes.DistanceUnit

Returns the default distance unit for the parameter.

See also

setDefaultUnit()

New in version 3.4.3.

dependsOnOtherParameters(self) → List[str]
fromVariantMap(self, map: Dict[str, Any]) → bool
parentParameterName(self) → str

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

setDefaultUnit(self, unit: QgsUnitTypes.DistanceUnit)

Sets the default distance unit for the parameter.

See also

defaultUnit()

New in version 3.4.3.

setParentParameterName(self, parentParameterName: str)

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

toVariantMap(self) → Dict[str, Any]
type(self) → str
typeName() → str

Returns the type name for the parameter class.