Subgroup: Processing
Class: QgsProcessingParameterDefinition¶
-
class
qgis.core.
QgsProcessingParameterDefinition
¶ Bases:
sip.wrapper
Base class for the definition of processing parameters.
Parameter definitions encapsulate properties regarding the behavior of parameters, their acceptable ranges, defaults, etc.
New in version 3.0: Methods
algorithm
Returns a pointer to the algorithm which owns this parameter. asScriptCode
Returns the parameter definition encoded in a string which can be used within a Python processing script. checkValueIsAcceptable
Checks whether the specified input
value is acceptable for the parameter.clone
Creates a clone of the parameter definition. defaultValue
Returns the default value for the parameter. dependsOnOtherParameters
Returns a list of other parameter names on which this parameter is dependent (e.g. description
Returns the description for the parameter. dynamicLayerParameterName
Returns the name of the parameter for a layer linked to a dynamic parameter, or an empty string if this is not set. dynamicPropertyDefinition
Returns the property definition for dynamic properties. flags
Returns any flags associated with the parameter. fromVariantMap
Restores this parameter to a QVariantMap. isDestination
Returns true if this parameter represents a file or layer destination, e.g. isDynamic
Returns true if the parameter supports is dynamic, and can support data-defined values (i.e. metadata
Returns the parameter’s freeform metadata. name
Returns the name of the parameter. provider
Returns a pointer to the provider for the algorithm which owns this parameter. setDefaultValue
Sets the default value
for the parameter.setDescription
Sets the description
for the parameter.setDynamicLayerParameterName
Sets the name
for the parameter for a layer linked to a dynamic parameter, or an empty string if this is not set.setDynamicPropertyDefinition
Sets the property definition
for dynamic properties.setFlags
Sets the flags
associated with the parameter.setIsDynamic
Sets whether the parameter is dynamic
, and can support data-defined values (i.e.setMetadata
Sets the parameter’s freeform metadata
.setName
Sets the name
of the parameter.toVariantMap
Saves this parameter to a QVariantMap. toolTip
Returns a formatted tooltip for use with the parameter, which gives helpful information like parameter description, ID, and extra content like default values (depending on parameter type). type
Unique parameter type name. valueAsPythonString
Returns a string version of the parameter input value
, which is suitable for use as an input parameter value when running an algorithm directly from a Python command.Attributes
FlagAdvanced
FlagHidden
FlagOptional
-
class
Flag
¶ Bases:
int
-
FlagAdvanced
= 2¶
-
FlagHidden
= 4¶
-
FlagOptional
= 8¶
-
class
Flags
¶ Bases:
sip.wrapper
QgsProcessingParameterDefinition.Flags(Union[QgsProcessingParameterDefinition.Flags, QgsProcessingParameterDefinition.Flag]) QgsProcessingParameterDefinition.Flags(QgsProcessingParameterDefinition.Flags)
-
algorithm
(self) → QgsProcessingAlgorithm¶ Returns a pointer to the algorithm which owns this parameter. May be None for non-owned parameters.
See also
-
asScriptCode
(self) → str¶ Returns the parameter definition encoded in a string which can be used within a Python processing script.
-
checkValueIsAcceptable
(self, input: Any, context: QgsProcessingContext = None) → bool¶ Checks whether the specified
input
value is acceptable for the parameter. Returns true if the value can be accepted. The optionalcontext
parameter can be specified to allow a more stringent check to be performed, capable of checking for the presence of required layers and other factors within the context.
-
clone
(self) → QgsProcessingParameterDefinition¶ Creates a clone of the parameter definition.
-
defaultValue
(self) → Any¶ Returns the default value for the parameter.
See also
-
dependsOnOtherParameters
(self) → List[str]¶ Returns a list of other parameter names on which this parameter is dependent (e.g. field parameters which depend on a parent layer parameter).
-
description
(self) → str¶ Returns the description for the parameter. This is the user-visible string used to identify this parameter.
See also
-
dynamicLayerParameterName
(self) → str¶ Returns the name of the parameter for a layer linked to a dynamic parameter, or an empty string if this is not set.
Dynamic parameters (see isDynamic()) can have an optional vector layer parameter linked to them, which indicates which layer the fields and values will be available from when evaluating the dynamic parameter.
See also
See also
See also
-
dynamicPropertyDefinition
(self) → QgsPropertyDefinition¶ Returns the property definition for dynamic properties.
See also
See also
See also
-
flags
(self) → QgsProcessingParameterDefinition.Flags¶ Returns any flags associated with the parameter.
See also
-
fromVariantMap
(self, map: Dict[str, Any]) → bool¶ Restores this parameter to a QVariantMap. Subclasses should ensure that they call the base class method.
See also
-
isDestination
(self) → bool¶ Returns true if this parameter represents a file or layer destination, e.g. parameters which are used for the destination for layers output by an algorithm will return true.
-
isDynamic
(self) → bool¶ Returns true if the parameter supports is dynamic, and can support data-defined values (i.e. QgsProperty based values).
See also
See also
See also
-
metadata
(self) → Dict[str, Any]¶ Returns the parameter’s freeform metadata. This is mostly used by parameter widget wrappers in order to customise their appearance and behavior.
See also
-
name
(self) → str¶ Returns the name of the parameter. This is the internal identifier by which algorithms access this parameter.
See also
-
provider
(self) → QgsProcessingProvider¶ Returns a pointer to the provider for the algorithm which owns this parameter. May be None for non-owned parameters or algorithms.
See also
-
setDefaultValue
(self, value: Any)¶ Sets the default
value
for the parameter. Caller takes responsibility to ensure thatvalue
is a valid input for the parameter subclass.See also
-
setDescription
(self, description: str)¶ Sets the
description
for the parameter. This is the user-visible string used to identify this parameter.See also
-
setDynamicLayerParameterName
(self, name: str)¶ Sets the
name
for the parameter for a layer linked to a dynamic parameter, or an empty string if this is not set.Dynamic parameters (see isDynamic()) can have an optional vector layer parameter linked to them, which indicates which layer the fields and values will be available from when evaluating the dynamic parameter.
See also
See also
See also
-
setDynamicPropertyDefinition
(self, definition: QgsPropertyDefinition)¶ Sets the property
definition
for dynamic properties.See also
See also
See also
-
setFlags
(self, flags: Union[QgsProcessingParameterDefinition.Flags, QgsProcessingParameterDefinition.Flag])¶ Sets the
flags
associated with the parameter.See also
-
setIsDynamic
(self, dynamic: bool)¶ Sets whether the parameter is
dynamic
, and can support data-defined values (i.e. QgsProperty based values).See also
See also
See also
-
setMetadata
(self, metadata: Dict[str, Any])¶ Sets the parameter’s freeform
metadata
. This is mostly used by parameter widget wrappers in order to customise their appearance and behavior.See also
-
setName
(self, name: str)¶ Sets the
name
of the parameter. This is the internal identifier by which algorithms access this parameter.See also
-
toVariantMap
(self) → Dict[str, Any]¶ Saves this parameter to a QVariantMap. Subclasses should ensure that they call the base class method and then extend the result with additional properties.
See also
-
toolTip
(self) → str¶ Returns a formatted tooltip for use with the parameter, which gives helpful information like parameter description, ID, and extra content like default values (depending on parameter type).
-
type
(self) → str¶ Unique parameter type name.
-
valueAsPythonString
(self, value: Any, context: QgsProcessingContext) → str¶ Returns a string version of the parameter input
value
, which is suitable for use as an input parameter value when running an algorithm directly from a Python command. The returned value must be correctly escaped - e.g. string values must be wrapped in ‘ ‘s.
-
class