Class: QgsProcessingParameterField

A vector layer or feature source field parameter for processing algorithms.

Class Hierarchy

Inheritance diagram of qgis.core.QgsProcessingParameterField

Base classes

QgsProcessingParameterDefinition

Base class for the definition of processing parameters.

Enums

DataType

alias of ProcessingFieldParameterDataType

Methods

allowMultiple

Returns whether multiple field selections are permitted.

dataType

Returns the acceptable data type for the field.

defaultToAllFields

Returns whether a parameter which allows multiple selections (see allowMultiple()) should automatically select all fields as the default value.

parentLayerParameterName

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

setAllowMultiple

Sets whether multiple field selections are permitted.

setDataType

Sets the acceptable data type for the field.

setDefaultToAllFields

Sets whether a parameter which allows multiple selections (see allowMultiple()) should automatically select all fields as the default value.

setParentLayerParameterName

Sets the name of the parent layer parameter.

Static Methods

fromScriptCode

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

typeName

Returns the type name for the parameter class.

class qgis.core.QgsProcessingParameterField[source]

Bases: QgsProcessingParameterDefinition

__init__(name: str | None, description: str | None = '', defaultValue: Any = None, parentLayerParameterName: str | None = '', type: Qgis.ProcessingFieldParameterDataType = Qgis.ProcessingFieldParameterDataType.Any, allowMultiple: bool = False, optional: bool = False, defaultToAllFields: bool = False)

Constructor for QgsProcessingParameterField.

Parameters:
  • name (Optional[str])

  • description (Optional[str] = '')

  • defaultValue (Any = None)

  • parentLayerParameterName (Optional[str] = '')

  • type (Qgis.ProcessingFieldParameterDataType = Qgis.ProcessingFieldParameterDataType.Any)

  • allowMultiple (bool = False)

  • optional (bool = False)

  • defaultToAllFields (bool = False)

__init__(a0: QgsProcessingParameterField)
Parameters:

a0 (QgsProcessingParameterField)

DataType

alias of ProcessingFieldParameterDataType

allowMultiple(self) bool[source]

Returns whether multiple field selections are permitted.

Return type:

bool

dataType(self) Qgis.ProcessingFieldParameterDataType[source]

Returns the acceptable data type for the field.

See also

setDataType()

Return type:

Qgis.ProcessingFieldParameterDataType

defaultToAllFields(self) bool[source]

Returns whether a parameter which allows multiple selections (see allowMultiple()) should automatically select all fields as the default value.

If True, this will override any existing defaultValue() set on the parameter.

Added in version 3.12.

Return type:

bool

static fromScriptCode(name: str | None, description: str | None, isOptional: bool, definition: str | None) QgsProcessingParameterField | 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[QgsProcessingParameterField]

parentLayerParameterName(self) str[source]

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

Return type:

str

setAllowMultiple(self, allowMultiple: bool)[source]

Sets whether multiple field selections are permitted.

See also

allowMultiple()

Parameters:

allowMultiple (bool)

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

Sets the acceptable data type for the field.

See also

dataType()

Parameters:

type (Qgis.ProcessingFieldParameterDataType)

setDefaultToAllFields(self, enabled: bool)[source]

Sets whether a parameter which allows multiple selections (see allowMultiple()) should automatically select all fields as the default value.

If True, this will override any existing defaultValue() set on the parameter.

Added in version 3.12.

Parameters:

enabled (bool)

setParentLayerParameterName(self, parentLayerParameterName: str | None)[source]

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

Parameters:

parentLayerParameterName (Optional[str])

static typeName() str[source]

Returns the type name for the parameter class.

Return type:

str