Class: QgsProcessingToolboxModel

class qgis.gui.QgsProcessingToolboxModel

Bases: PyQt5.QtCore.QAbstractItemModel

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.

QgsProcessingToolboxModel(parent: Optional[QObject] = None, registry: Optional[QgsProcessingRegistry] = None, recentLog: Optional[QgsProcessingRecentAlgorithmLog] = 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.

Enums

CustomRole

Bases: enum.IntEnum

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.

beginInsertColumns

beginInsertRows

beginMoveColumns

beginMoveRows

beginRemoveColumns

beginRemoveRows

beginResetModel

changePersistentIndex

changePersistentIndexList

childEvent

columnCount

param a0:

connectNotify

createIndex

customEvent

data

param index:

decodeData

disconnectNotify

encodeData

endInsertColumns

endInsertRows

endMoveColumns

endMoveRows

endRemoveColumns

endRemoveRows

endResetModel

flags

param index:

index

param row:

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.

isSignalConnected

mimeData

param indexes:

node2index

Returns the model index corresponding to the given node.

parent

param index:

persistentIndexList

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.

receivers

resetInternalData

rowCount

param parent:

sender

senderSignalIndex

timerEvent

Signals

recentAlgorithmAdded

pyqtSignal(*types, name: str = ..., revision: int = ..., arguments: Sequence = ...) -> PYQT_SIGNAL

class CustomRole(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)

Bases: enum.IntEnum

Custom model roles.

Note

Prior to QGIS 3.36 this was available as QgsProcessingToolboxModel.Roles

Added in version 3.36.

  • RoleNodeType: Corresponds to the node’s type

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

  • RoleAlgorithmId: Algorithm ID, for algorithm nodes

  • RoleAlgorithmName: Untranslated algorithm name, for algorithm nodes

  • RoleAlgorithmShortDescription: Short algorithm description, for algorithm nodes

  • RoleAlgorithmTags: List of algorithm tags, for algorithm nodes

  • RoleProviderFlags: Returns the node’s provider flags

baseClass

alias of QgsProcessingToolboxModel

Roles

alias of CustomRole

algorithmForIndex(self, index: QModelIndex) QgsProcessingAlgorithm | None

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]

beginInsertColumns(self, parent: QModelIndex, first: int, last: int)
beginInsertRows(self, parent: QModelIndex, first: int, last: int)
beginMoveColumns(self, sourceParent: QModelIndex, sourceFirst: int, sourceLast: int, destinationParent: QModelIndex, destinationColumn: int) bool
beginMoveRows(self, sourceParent: QModelIndex, sourceFirst: int, sourceLast: int, destinationParent: QModelIndex, destinationRow: int) bool
beginRemoveColumns(self, parent: QModelIndex, first: int, last: int)
beginRemoveRows(self, parent: QModelIndex, first: int, last: int)
beginResetModel(self)
changePersistentIndex(self, from_: QModelIndex, to: QModelIndex)
changePersistentIndexList(self, from_: Iterable[QModelIndex], to: Iterable[QModelIndex])
childEvent(self, a0: QChildEvent | None)
columnCount(self, a0: QModelIndex = QModelIndex()) int
Parameters:

a0 (QModelIndex = QModelIndex())

Return type:

int

connectNotify(self, signal: QMetaMethod)
createIndex(self, row: int, column: int, object: Any = None) QModelIndex
customEvent(self, a0: QEvent | None)
data(self, index: QModelIndex, role: int = Qt.DisplayRole) Any
Parameters:
  • index (QModelIndex)

  • role (int = Qt.DisplayRole)

Return type:

Any

decodeData(self, row: int, column: int, parent: QModelIndex, stream: QDataStream) bool
disconnectNotify(self, signal: QMetaMethod)
encodeData(self, indexes: Iterable[QModelIndex], stream: QDataStream)
endInsertColumns(self)
endInsertRows(self)
endMoveColumns(self)
endMoveRows(self)
endRemoveColumns(self)
endRemoveRows(self)
endResetModel(self)
flags(self, index: QModelIndex) Qt.ItemFlags
Parameters:

index (QModelIndex)

Return type:

Qt.ItemFlags

index(self, row: int, column: int, parent: QModelIndex = QModelIndex()) QModelIndex
Parameters:
  • row (int)

  • column (int)

  • parent (QModelIndex = QModelIndex())

Return type:

QModelIndex

index2node(self, index: QModelIndex) QgsProcessingToolboxModelNode | None

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

Returns the index corresponding to the specified providerId.

Parameters:

providerId (Optional[str])

Return type:

QModelIndex

indexOfParentTreeNode(self, parentNode: QgsProcessingToolboxModelNode | None) QModelIndex

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

Parameters:

parentNode (Optional[QgsProcessingToolboxModelNode])

Return type:

QModelIndex

isAlgorithm(self, index: QModelIndex) bool

Returns True if index corresponds to an algorithm.

Parameters:

index (QModelIndex)

Return type:

bool

isSignalConnected(self, signal: QMetaMethod) bool
mimeData(self, indexes: Iterable[QModelIndex]) QMimeData | None
Parameters:

indexes (Iterable[QModelIndex])

Return type:

Optional[QMimeData]

node2index(self, node: QgsProcessingToolboxModelNode | None) QModelIndex

Returns the model index corresponding to the given node.

See also

index2node()

Parameters:

node (Optional[QgsProcessingToolboxModelNode])

Return type:

QModelIndex

parent(self, index: QModelIndex) QModelIndex
Parameters:

index (QModelIndex)

Return type:

QModelIndex

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

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

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

receivers(self, signal: PYQT_SIGNAL) int
recentAlgorithmAdded

pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

Parameters:
  • name (str = ...)

  • revision (int = ...)

  • arguments (Sequence = ...)

Return type:

PYQT_SIGNAL

resetInternalData(self)
rowCount(self, parent: QModelIndex = QModelIndex()) int
Parameters:

parent (QModelIndex = QModelIndex())

Return type:

int

sender(self) QObject | None
senderSignalIndex(self) int
timerEvent(self, a0: QTimerEvent | None)