QGIS API Documentation  3.4.15-Madeira (e83d02e274)
Public Types | Signals | Public Member Functions | List of all members
QgsProcessingToolboxModel Class Reference

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

#include <qgsprocessingtoolboxmodel.h>

Inheritance diagram for QgsProcessingToolboxModel:
Inheritance graph
[legend]

Public Types

enum  Roles {
  RoleNodeType = Qt::UserRole, RoleAlgorithmFlags, RoleAlgorithmId, RoleAlgorithmName,
  RoleAlgorithmShortDescription, RoleAlgorithmTags
}
 Custom roles used by the model. More...
 

Signals

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

Public Member Functions

 QgsProcessingToolboxModel (QObject *parent=nullptr, QgsProcessingRegistry *registry=nullptr, QgsProcessingRecentAlgorithmLog *recentLog=nullptr)
 Constructor for QgsProcessingToolboxModel, with the given parent object. More...
 
const QgsProcessingAlgorithmalgorithmForIndex (const QModelIndex &index) const
 Returns the algorithm which corresponds to a given index, or a nullptr if the index does not represent an algorithm. More...
 
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. More...
 
QModelIndex indexForProvider (const QString &providerId) const
 Returns the index corresponding to the specified providerId. More...
 
QModelIndex indexOfParentTreeNode (QgsProcessingToolboxModelNode *parentNode) const
 Returns the index corresponding to the parent of a given node. More...
 
bool isAlgorithm (const QModelIndex &index) const
 Returns true if index corresponds to an algorithm. More...
 
QMimeData * mimeData (const QModelIndexList &indexes) const override
 
QModelIndex node2index (QgsProcessingToolboxModelNode *node) const
 Returns the model index corresponding to the given node. More...
 
QModelIndex parent (const QModelIndex &index) const override
 
QgsProcessingProviderproviderForIndex (const QModelIndex &index) const
 Returns the provider which corresponds to a given index, or a nullptr if the index does not represent a provider. More...
 
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. More...
 
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 274 of file qgsprocessingtoolboxmodel.h.

Member Enumeration Documentation

Custom roles used by the model.

Enumerator
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.

Definition at line 281 of file qgsprocessingtoolboxmodel.h.

Constructor & Destructor 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::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.

Definition at line 116 of file qgsprocessingtoolboxmodel.cpp.

Member Function Documentation

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.

See also
isAlgorithm()
providerForIndex()

Definition at line 595 of file qgsprocessingtoolboxmodel.cpp.

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

Definition at line 525 of file qgsprocessingtoolboxmodel.cpp.

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

Definition at line 335 of file qgsprocessingtoolboxmodel.cpp.

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

Definition at line 327 of file qgsprocessingtoolboxmodel.cpp.

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

Definition at line 530 of file qgsprocessingtoolboxmodel.cpp.

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

Returns the model node corresponding to the given index.

See also
node2index()

Definition at line 246 of file qgsprocessingtoolboxmodel.cpp.

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

Returns the index corresponding to the specified providerId.

See also
providerForIndex()

Definition at line 610 of file qgsprocessingtoolboxmodel.cpp.

QModelIndex QgsProcessingToolboxModel::indexOfParentTreeNode ( QgsProcessingToolboxModelNode *  parentNode) const

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

Definition at line 631 of file qgsprocessingtoolboxmodel.cpp.

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

Returns true if index corresponds to an algorithm.

See also
algorithmForIndex()

Definition at line 604 of file qgsprocessingtoolboxmodel.cpp.

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

Definition at line 558 of file qgsprocessingtoolboxmodel.cpp.

QModelIndex QgsProcessingToolboxModel::node2index ( QgsProcessingToolboxModelNode *  node) const

Returns the model index corresponding to the given node.

See also
index2node()

Definition at line 255 of file qgsprocessingtoolboxmodel.cpp.

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

Definition at line 542 of file qgsprocessingtoolboxmodel.cpp.

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.

See also
algorithmForIndex()
indexForProvider()

Definition at line 577 of file qgsprocessingtoolboxmodel.cpp.

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 586 of file qgsprocessingtoolboxmodel.cpp.

void QgsProcessingToolboxModel::recentAlgorithmAdded ( )
signal

Emitted whenever recent algorithms are added to the model.

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

Definition at line 516 of file qgsprocessingtoolboxmodel.cpp.


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