Class: QgsProcessingParameterNumber

A numeric parameter for processing algorithms.

For numeric parameters with a dataType() of Double, the number of decimals places shown in the parameter’s widget can be specified by setting the parameter’s metadata. For example:

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

Class Hierarchy

Inheritance diagram of qgis.core.QgsProcessingParameterNumber

Base classes

QgsProcessingParameterDefinition

Base class for the definition of processing parameters.

Subclasses

QgsProcessingParameterArea

A double numeric parameter for area values.

QgsProcessingParameterDistance

A double numeric parameter for distance values.

QgsProcessingParameterDuration

A double numeric parameter for duration values.

QgsProcessingParameterScale

A double numeric parameter for map scale values.

QgsProcessingParameterVolume

A double numeric parameter for volume values.

class qgis.core.QgsProcessingParameterNumber[source]

Bases: QgsProcessingParameterDefinition

__init__(name: str | None, description: str | None = '', type: Qgis.ProcessingNumberParameterType = Qgis.ProcessingNumberParameterType.Integer, defaultValue: Any = None, optional: bool = False, minValue: float = -DBL_MAX + 1, maxValue: float = DBL_MAX)

Constructor for QgsProcessingParameterNumber.

Parameters:
  • name (Optional[str])

  • description (Optional[str] = '')

  • type (Qgis.ProcessingNumberParameterType = Qgis.ProcessingNumberParameterType.Integer)

  • defaultValue (Any = None)

  • optional (bool = False)

  • minValue (float = -DBL_MAX+1)

  • maxValue (float = DBL_MAX)

__init__(a0: QgsProcessingParameterNumber)
Parameters:

a0 (QgsProcessingParameterNumber)

Type

alias of ProcessingNumberParameterType

dataType(self) Qgis.ProcessingNumberParameterType[source]

Returns the acceptable data type for the parameter.

See also

setDataType()

Return type:

Qgis.ProcessingNumberParameterType

static fromScriptCode(name: str | None, description: str | None, isOptional: bool, definition: str | None) QgsProcessingParameterNumber | None[source]

Creates a new parameter using the definition from a script code.

Parameters:
  • name (Optional[str])

  • description (Optional[str])

  • isOptional (bool)

  • definition (Optional[str])

Return type:

Optional[QgsProcessingParameterNumber]

maximum(self) float[source]

Returns the maximum value acceptable by the parameter.

See also

setMaximum()

Return type:

float

minimum(self) float[source]

Returns the minimum value acceptable by the parameter.

See also

setMinimum()

Return type:

float

setDataType(self, type: Qgis.ProcessingNumberParameterType)[source]

Sets the acceptable data type for the parameter.

See also

dataType()

Parameters:

type (Qgis.ProcessingNumberParameterType)

setMaximum(self, maximum: float)[source]

Sets the maximum value acceptable by the parameter.

See also

maximum()

Parameters:

maximum (float)

setMinimum(self, minimum: float)[source]

Sets the minimum value acceptable by the parameter.

See also

minimum()

Parameters:

minimum (float)

static typeName() str[source]

Returns the type name for the parameter class.

Return type:

str