Class: QgsProcessingParameterEnum¶
An enum based parameter for processing algorithms, allowing for selection from predefined values.
Since QGIS 3.24 a list of icons corresponding to the enum values can be specified by setting the widget wrapper metadata “icons” option, as demonstrated below. The “icons” value should be set to a list of QIcon values.
param = QgsProcessingParameterEnum( 'FIELD_TYPE', 'Field type', ['Integer', 'String'])
param.setMetadata( {'widget_wrapper':
{ 'icons': [QIcon('integer.svg'), QIcon('string.svg')] }
})
Class Hierarchy¶
Base classes¶
Base class for the definition of processing parameters. |
Methods
Returns |
|
Returns the list of acceptable options for the parameter. |
|
Sets whether the parameter allows multiple selected values. |
|
Sets the list of acceptable options for the parameter. |
|
Sets whether the parameter uses static (non-translated) string values for its enumeration choice list. |
|
Returns |
Static Methods
Creates a new parameter using the definition from a script code. |
|
Returns the type name for the parameter class. |
- class qgis.core.QgsProcessingParameterEnum[source]¶
Bases:
QgsProcessingParameterDefinition
- __init__(name: str | None, description: str | None = '', options: Iterable[str | None] = [], allowMultiple: bool = False, defaultValue: Any = None, optional: bool = False, usesStaticStrings: bool = False)
Constructor for QgsProcessingParameterEnum.
- Parameters:
name (Optional[str])
description (Optional[str] = '')
options (Iterable[Optional[str]] = [])
allowMultiple (bool = False)
defaultValue (Any = None)
optional (bool = False)
usesStaticStrings (bool = False)
- __init__(a0: QgsProcessingParameterEnum)
- Parameters:
- allowMultiple(self) bool [source]¶
Returns
True
if the parameter allows multiple selected values.See also
- Return type:
bool
- static fromScriptCode(name: str | None, description: str | None, isOptional: bool, definition: str | None) QgsProcessingParameterEnum | 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[QgsProcessingParameterEnum]
- options(self) List[str] [source]¶
Returns the list of acceptable options for the parameter.
See also
- Return type:
List[str]
- setAllowMultiple(self, allowMultiple: bool)[source]¶
Sets whether the parameter allows multiple selected values.
See also
- Parameters:
allowMultiple (bool)
- setOptions(self, options: Iterable[str | None])[source]¶
Sets the list of acceptable
options
for the parameter.See also
- Parameters:
options (Iterable[Optional[str]])
- setUsesStaticStrings(self, usesStaticStrings: bool)[source]¶
Sets whether the parameter uses static (non-translated) string values for its enumeration choice list.
See also
Added in version 3.18.
- Parameters:
usesStaticStrings (bool)