QgsProcessingToolboxModel class
A model for providers and algorithms shown within the Processing toolbox.
Contents
See QgsProcessingToolboxProxyModel for a sorted, filterable version of this model.
Public types
- enum Roles { RoleNodeType = Qt::UserRole, RoleAlgorithmFlags, RoleAlgorithmId, RoleAlgorithmName, RoleAlgorithmShortDescription, RoleAlgorithmTags }
- Custom roles used by the model.
Constructors, destructors, conversion operators
- QgsProcessingToolboxModel(QObject* parent = nullptr, QgsProcessingRegistry* registry = nullptr, QgsProcessingRecentAlgorithmLog* recentLog = nullptr)
- Constructor for QgsProcessingToolboxModel, with the given parent object.
Public functions
- auto algorithmForIndex(const QModelIndex& index) const -> const QgsProcessingAlgorithm*
- Returns the algorithm which corresponds to a given index, or a nullptr if the index does not represent an algorithm.
- auto index2node(const QModelIndex& index) const -> QgsProcessingToolboxModelNode*
- Returns the model node corresponding to the given index.
- auto indexForProvider(const QString& providerId) const -> QModelIndex
- Returns the index corresponding to the specified providerId.
- auto indexOfParentTreeNode(QgsProcessingToolboxModelNode* parentNode) const -> QModelIndex
- Returns the index corresponding to the parent of a given node.
- auto isAlgorithm(const QModelIndex& index) const -> bool
- Returns true if index corresponds to an algorithm.
- auto node2index(QgsProcessingToolboxModelNode* node) const -> QModelIndex
- Returns the model index corresponding to the given node.
- auto providerForIndex(const QModelIndex& index) const -> QgsProcessingProvider*
- Returns the provider which corresponds to a given index, or a nullptr if the index does not represent a provider.
- auto providerIdForIndex(const QModelIndex& index) const -> QString
- Returns the provider ID which corresponds to a given index, or an empty string if the index does not represent a provider.
Signals
- void recentAlgorithmAdded()
- Emitted whenever recent algorithms are added to the model.
Enum documentation
enum QgsProcessingToolboxModel:: Roles
Custom roles used by the model.
| Enumerators | |
|---|---|
| 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. |
Function documentation
QgsProcessingToolboxModel:: QgsProcessingToolboxModel(QObject* parent = nullptr,
QgsProcessingRegistry* registry = nullptr,
QgsProcessingRecentAlgorithmLog* recentLog = nullptr)
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::
If recentLog is specified then it will be used to create a "Recently used" top level group containing recently used algorithms.
const QgsProcessingAlgorithm* QgsProcessingToolboxModel:: algorithmForIndex(const QModelIndex& index) const
Returns the algorithm which corresponds to a given index, or a nullptr if the index does not represent an algorithm.
QgsProcessingToolboxModelNode* QgsProcessingToolboxModel:: index2node(const QModelIndex& index) const
Returns the model node corresponding to the given index.
QModelIndex QgsProcessingToolboxModel:: indexForProvider(const QString& providerId) const
Returns the index corresponding to the specified providerId.
bool QgsProcessingToolboxModel:: isAlgorithm(const QModelIndex& index) const
Returns true if index corresponds to an algorithm.
QModelIndex QgsProcessingToolboxModel:: node2index(QgsProcessingToolboxModelNode* node) const
Returns the model index corresponding to the given node.
QgsProcessingProvider* QgsProcessingToolboxModel:: providerForIndex(const QModelIndex& index) const
Returns the provider which corresponds to a given index, or a nullptr if the index does not represent a provider.
QString QgsProcessingToolboxModel:: providerIdForIndex(const QModelIndex& index) const
Returns the provider ID which corresponds to a given index, or an empty string if the index does not represent a provider.