Class: QgsProcessingParameterLayoutItem

class qgis.core.QgsProcessingParameterLayoutItem(name: str, description: str = '', defaultValue: Any = None, parentLayoutParameterName: str = '', itemType: int = -1, optional: bool = False)

Bases: QgsProcessingParameterDefinition

Constructor for QgsProcessingParameterLayoutItem.

QgsProcessingParameterLayoutItem(QgsProcessingParameterLayoutItem)

A print layout item parameter, allowing users to select a particular item from a print layout.

QgsProcessingParameterLayoutItem should be evaluated by calling QgsProcessingAlgorithm.parameterAsLayoutItem() Internally, QgsProcessingParameterLayoutItems are string parameters, storing references to items either by their UUID (QgsLayoutItem.uuid()) or ID (QgsLayoutItem.id()).

New in version 3.8.

Parameters
  • name (str) –

  • description (str = '') –

  • defaultValue (Any = None) –

  • parentLayoutParameterName (str = '') –

  • itemType (int = -1) –

  • optional

asPythonString(self, outputType: QgsProcessing.PythonOutputType = QgsProcessing.PythonQgsProcessingAlgorithmSubclass) → str
Parameters

outputType (QgsProcessing.PythonOutputType = QgsProcessing.PythonQgsProcessingAlgorithmSubclass) –

Return type

str

asScriptCode(self) → str
Return type

str

clone(self) → QgsProcessingParameterDefinition
Return type

QgsProcessingParameterDefinition

dependsOnOtherParameters(self) → List[str]
Return type

List[str]

fromScriptCode(name: str, description: str, isOptional: bool, definition: str) → QgsProcessingParameterLayoutItem

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

Parameters
  • name (str) –

  • description (str) –

  • isOptional (bool) –

  • definition (str) –

Return type

QgsProcessingParameterLayoutItem

fromVariantMap(self, map: Dict[str, Any]) → bool
Parameters

map (Dict[str) –

Return type

bool

itemType(self) → int

Returns the acceptable item type, or -1 if any item type is allowed.

These values correspond to the registered item types from QgsLayoutItemRegistry.

See also

setItemType()

Return type

int

parentLayoutParameterName(self) → str

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

Return type

str

setItemType(self, type: int)

Sets the acceptable item type, or -1 if any item type is allowed.

These values correspond to the registered item types from QgsLayoutItemRegistry.

See also

itemType()

Parameters

type (int) –

setParentLayoutParameterName(self, name: str)

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

Parameters

name (str) –

toVariantMap(self) → Dict[str, Any]
Return type

Dict[str, Any]

type(self) → str
Return type

str

typeName() → str

Returns the type name for the parameter class.

Return type

str

valueAsPythonString(self, value: Any, context: QgsProcessingContext) → str
Parameters
Return type

str