Class: QgsProcessingToolboxModel

A model for providers and algorithms shown within the Processing toolbox.

See QgsProcessingToolboxProxyModel for a sorted, filterable version of this model.

Added in version 3.4.

Class Hierarchy

Inheritance diagram of qgis.gui.QgsProcessingToolboxModel

Base classes

QAbstractItemModel

QObject

Enums

CustomRole

Custom model roles.

Roles

alias of CustomRole

Methods

algorithmForIndex

Returns the algorithm which corresponds to a given index, or None if the index does not represent an algorithm.

index2node

Returns the model node corresponding to the given index.

indexForProvider

Returns the index corresponding to the specified providerId.

indexOfParentTreeNode

Returns the index corresponding to the parent of a given node.

isAlgorithm

Returns True if index corresponds to an algorithm.

node2index

Returns the model index corresponding to the given node.

providerForIndex

Returns the provider which corresponds to a given index, or None if the index does not represent a provider.

providerIdForIndex

Returns the provider ID which corresponds to a given index, or an empty string if the index does not represent a provider.

Signals

favoriteAlgorithmAdded

Emitted whenever favorite algorithms are added to the model.

recentAlgorithmAdded

Emitted whenever recent algorithms are added to the model.

class qgis.gui.QgsProcessingToolboxModel[source]

Bases: QAbstractItemModel

__init__(parent: QObject | None = None, registry: QgsProcessingRegistry | None = None, recentLog: QgsProcessingRecentAlgorithmLog | None = None, favoriteManager: QgsProcessingFavoriteAlgorithmManager | None = None)

Constructor for QgsProcessingToolboxModel, with the given parent object.

If registry is specified then the model will show providers and algorithms from the given registry. If no registry is specified, then the processing registry attached to QgsApplication.processingRegistry() will be used by the model.

If recentLog is specified then it will be used to create a “Recently used” top level group containing recently used algorithms.

If favoriteManager is specified then it will be used to create a “Favorites” top level group containing favorite algorithms. Since QGIS 3.40

Parameters:
class CustomRole(*values)

Bases: IntEnum

Custom model roles.

Note

Prior to QGIS 3.36 this was available as QgsProcessingToolboxModel.Roles

Added in version 3.36.

  • NodeType: Corresponds to the node’s type

    Available as QgsProcessingToolboxModel.RoleNodeType in older QGIS releases.

  • AlgorithmFlags: Returns the node’s algorithm flags, for algorithm nodes

    Available as QgsProcessingToolboxModel.RoleAlgorithmFlags in older QGIS releases.

  • AlgorithmId: Algorithm ID, for algorithm nodes

    Available as QgsProcessingToolboxModel.RoleAlgorithmId in older QGIS releases.

  • AlgorithmName: Untranslated algorithm name, for algorithm nodes

    Available as QgsProcessingToolboxModel.RoleAlgorithmName in older QGIS releases.

  • AlgorithmShortDescription: Short algorithm description, for algorithm nodes

    Available as QgsProcessingToolboxModel.RoleAlgorithmShortDescription in older QGIS releases.

  • AlgorithmTags: List of algorithm tags, for algorithm nodes

    Available as QgsProcessingToolboxModel.RoleAlgorithmTags in older QGIS releases.

  • ProviderFlags: Returns the node’s provider flags

    Available as QgsProcessingToolboxModel.RoleProviderFlags in older QGIS releases.

Roles

alias of CustomRole

algorithmForIndex(self, index: QModelIndex) QgsProcessingAlgorithm | None[source]

Returns the algorithm which corresponds to a given index, or None if the index does not represent an algorithm.

See also

isAlgorithm()

Parameters:

index (QModelIndex)

Return type:

Optional[QgsProcessingAlgorithm]

signal favoriteAlgorithmAdded[source]

Emitted whenever favorite algorithms are added to the model.

index2node(self, index: QModelIndex) QgsProcessingToolboxModelNode | None[source]

Returns the model node corresponding to the given index.

See also

node2index()

Parameters:

index (QModelIndex)

Return type:

Optional[QgsProcessingToolboxModelNode]

indexForProvider(self, providerId: str | None) QModelIndex[source]

Returns the index corresponding to the specified providerId.

Parameters:

providerId (Optional[str])

Return type:

QModelIndex

indexOfParentTreeNode(self, parentNode: QgsProcessingToolboxModelNode | None) QModelIndex[source]

Returns the index corresponding to the parent of a given node.

Parameters:

parentNode (Optional[QgsProcessingToolboxModelNode])

Return type:

QModelIndex

isAlgorithm(self, index: QModelIndex) bool[source]

Returns True if index corresponds to an algorithm.

Parameters:

index (QModelIndex)

Return type:

bool

node2index(self, node: QgsProcessingToolboxModelNode | None) QModelIndex[source]

Returns the model index corresponding to the given node.

See also

index2node()

Parameters:

node (Optional[QgsProcessingToolboxModelNode])

Return type:

QModelIndex

providerForIndex(self, index: QModelIndex) QgsProcessingProvider | None[source]

Returns the provider which corresponds to a given index, or None if the index does not represent a provider.

Parameters:

index (QModelIndex)

Return type:

Optional[QgsProcessingProvider]

providerIdForIndex(self, index: QModelIndex) str[source]

Returns the provider ID which corresponds to a given index, or an empty string if the index does not represent a provider.

Parameters:

index (QModelIndex)

Return type:

str

signal recentAlgorithmAdded[source]

Emitted whenever recent algorithms are added to the model.