Class: QgsProcessingParameterType

Makes metadata of processing parameters available.

Added in version 3.2.

Note

This is an abstract class, with methods which must be implemented by a subclass.

The following methods must be implemented: acceptedOutputTypes(), acceptedParameterTypes(), create(), description(), id(), name()

Enums

ParameterFlag

alias of ProcessingParameterTypeFlag

Abstract Methods

acceptedOutputTypes

Returns a list of compatible Processing output types for inputs for this parameter type.

acceptedParameterTypes

Returns a list of compatible Processing parameter types for inputs for this parameter type.

create

Creates a new parameter of this type.

description

A human readable and translatable description for this parameter type.

id

A static id for this type which will be used for storing this parameter type.

name

A human readable and translatable short name for this parameter type.

Virtual Methods

In PyQGIS, only methods marked as virtual can be safely overridden in a Python subclass of QgsProcessingParameterType. See the FAQ for more details.

acceptedDataTypes

Returns a list of compatible Processing data types for inputs for this parameter type for the specified parameter.

acceptedPythonTypes

Returns a list of the Python data types accepted as values for the parameter.

acceptedStringValues

Returns a descriptive list of the possible string values acceptable for the parameter.

className

Returns the corresponding class name for the parameter type.

flags

Determines if this parameter is available in the modeler.

metadata

Metadata for this parameter type.

pythonImportString

Returns a valid Python import string for importing the corresponding parameter type, e.g. "from qgis.core import QgsProcessingParameterBoolean".

class qgis.core.QgsProcessingParameterType[source]

Bases: object

ParameterFlag

alias of ProcessingParameterTypeFlag

ParameterFlags

alias of ProcessingParameterTypeFlags

virtual acceptedDataTypes(self, parameter: QgsProcessingParameterDefinition | None) List[int]

Returns a list of compatible Processing data types for inputs for this parameter type for the specified parameter.

In order to determine the available sources for the parameter in a model the types returned by this method are checked. The returned list corresponds to the various available values from QgsProcessing.SourceType.

Subclasses should return a list of all QgsProcessing.SourceType values which can be used as values for the parameter.

Added in version 3.44.

Parameters:

parameter (Optional[QgsProcessingParameterDefinition])

Return type:

List[int]

abstract acceptedOutputTypes(self) List[str][source]

Returns a list of compatible Processing output types for inputs for this parameter type.

In order to determine the available sources for the parameter in a model the types returned by this method are checked. The returned list corresponds to the various available values for QgsProcessingOutputDefinition.type().

Subclasses should return a list of all QgsProcessingOutputDefinition.type() values which can be used as values for the parameter.

Added in version 3.44.

Return type:

List[str]

abstract acceptedParameterTypes(self) List[str][source]

Returns a list of compatible Processing parameter types for inputs for this parameter type.

In order to determine the available sources for the parameter in a model the types returned by this method are checked. The returned list corresponds to the various available values for QgsProcessingParameterDefinition.type().

Subclasses should return a list of all QgsProcessingParameterDefinition.type() values which can be used as input values for the parameter.

Added in version 3.44.

Return type:

List[str]

virtual acceptedPythonTypes(self) List[str][source]

Returns a list of the Python data types accepted as values for the parameter. E.g. “str”, “QgsVectorLayer”, “QgsMapLayer”, etc.

These values should should match the Python types exactly (e.g. “str” not “string”, “bool” not “boolean”). Extra explanatory help can be used (which must be translated), eg “str: as comma delimited list of numbers”.

Return type:

List[str]

virtual acceptedStringValues(self) List[str][source]

Returns a descriptive list of the possible string values acceptable for the parameter.

E.g. for a QgsProcessingParameterVectorLayer this may include “Path to a vector layer”, for QgsProcessingParameterBoolean “1 for true, 0 for false” etc.

Extra explanatory help can be used (which must be translated), eg “a comma delimited list of numbers”.

Added in version 3.8.

Return type:

List[str]

virtual className(self) str[source]

Returns the corresponding class name for the parameter type.

Added in version 3.6.

Return type:

str

abstract create(self, name: str | None) QgsProcessingParameterDefinition | None[source]

Creates a new parameter of this type.

Parameters:

name (Optional[str])

Return type:

Optional[QgsProcessingParameterDefinition]

abstract description(self) str[source]

A human readable and translatable description for this parameter type. This can be a longer description suitable for tooltips and other elements that give the user context for a given parameter.

Return type:

str

virtual flags(self) Qgis.ProcessingParameterTypeFlags[source]

Determines if this parameter is available in the modeler. The default implementation returns True.

Return type:

Qgis.ProcessingParameterTypeFlags

abstract id(self) str[source]

A static id for this type which will be used for storing this parameter type.

Return type:

str

virtual metadata(self) Dict[str, Any][source]

Metadata for this parameter type. Can be used for example to define custom widgets. The default implementation returns an empty map.

Return type:

Dict[str, Any]

abstract name(self) str[source]

A human readable and translatable short name for this parameter type. This will be used in comboboxes and list widgets.

Return type:

str

virtual pythonImportString(self) str[source]

Returns a valid Python import string for importing the corresponding parameter type, e.g. “from qgis.core import QgsProcessingParameterBoolean”.

See also

className()

Added in version 3.6.

Return type:

str