QGIS API Documentation 3.99.0-Master (21b3aa880ba)
Loading...
Searching...
No Matches
QgsProcessingToolboxModel Class Reference

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

#include <qgsprocessingtoolboxmodel.h>

Inheritance diagram for QgsProcessingToolboxModel:

Public Types

enum class  CustomRole : int {
  NodeType = Qt::UserRole , AlgorithmFlags , AlgorithmId , AlgorithmName ,
  AlgorithmShortDescription , AlgorithmTags , ProviderFlags , ParameterTypeId
}
 Custom model roles. More...

Signals

void favoriteAlgorithmAdded ()
 Emitted whenever favorite algorithms are added to the model.
void recentAlgorithmAdded ()
 Emitted whenever recent algorithms are added to the model.

Public Member Functions

 QgsProcessingToolboxModel (QObject *parent=nullptr, QgsProcessingRegistry *registry=nullptr, QgsProcessingRecentAlgorithmLog *recentLog=nullptr, QgsProcessingFavoriteAlgorithmManager *favoriteManager=nullptr)
 Constructor for QgsProcessingToolboxModel, with the given parent object.
const QgsProcessingAlgorithmalgorithmForIndex (const QModelIndex &index) const
 Returns the algorithm which corresponds to a given index, or nullptr if the index does not represent an algorithm.
int columnCount (const QModelIndex &=QModelIndex()) const override
QVariant data (const QModelIndex &index, int role=Qt::DisplayRole) const override
Qt::ItemFlags flags (const QModelIndex &index) const override
QModelIndex index (int row, int column, const QModelIndex &parent=QModelIndex()) const override
QgsProcessingToolboxModelNode * index2node (const QModelIndex &index) const
 Returns the model node corresponding to the given index.
QModelIndex indexForProvider (const QString &providerId) const
 Returns the index corresponding to the specified providerId.
QModelIndex indexOfParentTreeNode (QgsProcessingToolboxModelNode *parentNode) const
 Returns the index corresponding to the parent of a given node.
bool isAlgorithm (const QModelIndex &index) const
 Returns true if index corresponds to an algorithm.
bool isParameter (const QModelIndex &index) const
 Returns true if index corresponds to a parameter.
QMimeData * mimeData (const QModelIndexList &indexes) const override
QModelIndex node2index (QgsProcessingToolboxModelNode *node) const
 Returns the model index corresponding to the given node.
const QgsProcessingParameterTypeparameterTypeForIndex (const QModelIndex &index) const
 Returns the algorithm which corresponds to a given index, or nullptr if the index does not represent an algorithm.
QModelIndex parent (const QModelIndex &index) const override
QgsProcessingProviderproviderForIndex (const QModelIndex &index) const
 Returns the provider which corresponds to a given index, or nullptr if the index does not represent a provider.
QString 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.
int rowCount (const QModelIndex &parent=QModelIndex()) const override

Detailed Description

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

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

Since
QGIS 3.4

Definition at line 341 of file qgsprocessingtoolboxmodel.h.

Member Enumeration Documentation

◆ CustomRole

enum class QgsProcessingToolboxModel::CustomRole : int
strong

Custom model roles.

Note
Prior to QGIS 3.36 this was available as QgsProcessingToolboxModel::Roles
Since
QGIS 3.36
Enumerator
NodeType 

Corresponds to the node's type.

AlgorithmFlags 

Returns the node's algorithm flags, for algorithm nodes.

AlgorithmId 

Algorithm ID, for algorithm nodes.

AlgorithmName 

Untranslated algorithm name, for algorithm nodes.

AlgorithmShortDescription 

Short algorithm description, for algorithm nodes.

AlgorithmTags 

List of algorithm tags, for algorithm nodes.

ProviderFlags 

Returns the node's provider flags.

ParameterTypeId 

Untranslated parameter type unique identifier for parameter nodes.

Since
QGIS 3.44

Definition at line 354 of file qgsprocessingtoolboxmodel.h.

Constructor & Destructor Documentation

◆ QgsProcessingToolboxModel()

QgsProcessingToolboxModel::QgsProcessingToolboxModel ( QObject * parent = nullptr,
QgsProcessingRegistry * registry = nullptr,
QgsProcessingRecentAlgorithmLog * recentLog = nullptr,
QgsProcessingFavoriteAlgorithmManager * favoriteManager = 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::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

Definition at line 133 of file qgsprocessingtoolboxmodel.cpp.

Member Function Documentation

◆ algorithmForIndex()

const QgsProcessingAlgorithm * QgsProcessingToolboxModel::algorithmForIndex ( const QModelIndex & index) const

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

See also
isAlgorithm()
providerForIndex()

Definition at line 753 of file qgsprocessingtoolboxmodel.cpp.

◆ columnCount()

int QgsProcessingToolboxModel::columnCount ( const QModelIndex & = QModelIndex()) const
override

Definition at line 665 of file qgsprocessingtoolboxmodel.cpp.

◆ data()

QVariant QgsProcessingToolboxModel::data ( const QModelIndex & index,
int role = Qt::DisplayRole ) const
override

Definition at line 415 of file qgsprocessingtoolboxmodel.cpp.

◆ favoriteAlgorithmAdded

void QgsProcessingToolboxModel::favoriteAlgorithmAdded ( )
signal

Emitted whenever favorite algorithms are added to the model.

◆ flags()

Qt::ItemFlags QgsProcessingToolboxModel::flags ( const QModelIndex & index) const
override

Definition at line 407 of file qgsprocessingtoolboxmodel.cpp.

◆ index()

QModelIndex QgsProcessingToolboxModel::index ( int row,
int column,
const QModelIndex & parent = QModelIndex() ) const
override

Definition at line 670 of file qgsprocessingtoolboxmodel.cpp.

◆ index2node()

QgsProcessingToolboxModelNode * QgsProcessingToolboxModel::index2node ( const QModelIndex & index) const

Returns the model node corresponding to the given index.

See also
node2index()

Definition at line 330 of file qgsprocessingtoolboxmodel.cpp.

◆ indexForProvider()

QModelIndex QgsProcessingToolboxModel::indexForProvider ( const QString & providerId) const

Returns the index corresponding to the specified providerId.

See also
providerForIndex()

Definition at line 783 of file qgsprocessingtoolboxmodel.cpp.

◆ indexOfParentTreeNode()

QModelIndex QgsProcessingToolboxModel::indexOfParentTreeNode ( QgsProcessingToolboxModelNode * parentNode) const

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

Definition at line 803 of file qgsprocessingtoolboxmodel.cpp.

◆ isAlgorithm()

bool QgsProcessingToolboxModel::isAlgorithm ( const QModelIndex & index) const

Returns true if index corresponds to an algorithm.

See also
algorithmForIndex()

Definition at line 762 of file qgsprocessingtoolboxmodel.cpp.

◆ isParameter()

bool QgsProcessingToolboxModel::isParameter ( const QModelIndex & index) const

Returns true if index corresponds to a parameter.

See also
parameterTypeForIndex()
Since
QGIS 3.44

Definition at line 768 of file qgsprocessingtoolboxmodel.cpp.

◆ mimeData()

QMimeData * QgsProcessingToolboxModel::mimeData ( const QModelIndexList & indexes) const
override

Definition at line 698 of file qgsprocessingtoolboxmodel.cpp.

◆ node2index()

QModelIndex QgsProcessingToolboxModel::node2index ( QgsProcessingToolboxModelNode * node) const

Returns the model index corresponding to the given node.

See also
index2node()

Definition at line 339 of file qgsprocessingtoolboxmodel.cpp.

◆ parameterTypeForIndex()

const QgsProcessingParameterType * QgsProcessingToolboxModel::parameterTypeForIndex ( const QModelIndex & index) const

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

See also
isParameter()
providerForIndex()
Since
QGIS 3.44

Definition at line 774 of file qgsprocessingtoolboxmodel.cpp.

◆ parent()

QModelIndex QgsProcessingToolboxModel::parent ( const QModelIndex & index) const
override

Definition at line 682 of file qgsprocessingtoolboxmodel.cpp.

◆ providerForIndex()

QgsProcessingProvider * QgsProcessingToolboxModel::providerForIndex ( const QModelIndex & index) const

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

See also
algorithmForIndex()
indexForProvider()

Definition at line 735 of file qgsprocessingtoolboxmodel.cpp.

◆ providerIdForIndex()

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.

See also
algorithmForIndex()
indexForProvider()

Definition at line 744 of file qgsprocessingtoolboxmodel.cpp.

◆ recentAlgorithmAdded

void QgsProcessingToolboxModel::recentAlgorithmAdded ( )
signal

Emitted whenever recent algorithms are added to the model.

◆ rowCount()

int QgsProcessingToolboxModel::rowCount ( const QModelIndex & parent = QModelIndex()) const
override

Definition at line 656 of file qgsprocessingtoolboxmodel.cpp.


The documentation for this class was generated from the following files: