QGIS API Documentation 4.3.0-Master (16eddb2670e)
Loading...
Searching...
No Matches
QgsProcessingToolboxProxyModel Class Reference

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

#include <qgsprocessingtoolboxmodel.h>

Inheritance diagram for QgsProcessingToolboxProxyModel:

Public Types

enum class  Filter : int {
  Toolbox = 1 << 1 , Modeler = 1 << 2 , InPlace = 1 << 3 , ShowKnownIssues = 1 << 4 ,
  ForSocketOutput = 1 << 5 , ForSocketInput = 1 << 6
}
 Available filter flags for filtering the model. More...
typedef QFlags< Filter > Filters

Public Member Functions

 QgsProcessingToolboxProxyModel (QObject *parent=nullptr, QgsProcessingRegistry *registry=nullptr, QgsProcessingRecentAlgorithmLog *recentLog=nullptr, QgsProcessingFavoriteAlgorithmManager *favoriteManager=nullptr)
 Constructor for QgsProcessingToolboxProxyModel, with the given parent object.
QVariant data (const QModelIndex &index, int role=Qt::DisplayRole) const override
bool filterAcceptsRow (int sourceRow, const QModelIndex &sourceParent) const override
Filters filters () const
 Returns any filters that affect how toolbox content is filtered.
QString filterString () const
 Returns the current filter string, if set.
bool lessThan (const QModelIndex &left, const QModelIndex &right) const override
void setFilterOutput (const QgsProcessingOutputDefinition *outputDefinition)
 Sets an outputDefinition, such that only algorithms which are compatible with the specified output definition will be shown.
void setFilterParameter (const QgsProcessingParameterDefinition *parameterDefinition)
 Sets a parameterDefinition, such that only algorithms or parameters which are compatible with the specified parameter definition will be shown.
void setFilters (QgsProcessingToolboxProxyModel::Filters filters)
 Set filters that affect how toolbox content is filtered.
void setFilterString (const QString &filter)
 Sets a filter string, such that only algorithms matching the specified string will be shown.
void setInPlaceLayer (QgsVectorLayer *layer)
 Sets the vector layer for in-place algorithm filter.
QgsProcessingToolboxModel * toolboxModel ()
 Returns the underlying source Processing toolbox model.
const QgsProcessingToolboxModel * toolboxModel () const
 Returns the underlying source Processing toolbox model.

Detailed Description

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

The model automatically sorts the toolbox in a logical fashion and supports filtering the results.

Since
QGIS 3.4

Definition at line 517 of file qgsprocessingtoolboxmodel.h.

Member Typedef Documentation

◆ Filters

Definition at line 539 of file qgsprocessingtoolboxmodel.h.

Member Enumeration Documentation

◆ Filter

enum class QgsProcessingToolboxProxyModel::Filter : int
strong

Available filter flags for filtering the model.

Enumerator
Toolbox 

Filters out any algorithms and content which should not be shown in the toolbox.

Modeler 

Filters out any algorithms and content which should not be shown in the modeler.

InPlace 

Only show algorithms which support in-place edits.

ShowKnownIssues 

Show algorithms with known issues (hidden by default).

ForSocketOutput 

Only show algorithms compatible with a certain socket output, use with setFilterOutput().

Since
QGIS 4.4
ForSocketInput 

Only show algorithms compatible with a certain input socket, use with setFilterOutput() xor setFilterParameter().

Since
QGIS 4.4

Definition at line 525 of file qgsprocessingtoolboxmodel.h.

Constructor & Destructor Documentation

◆ QgsProcessingToolboxProxyModel()

QgsProcessingToolboxProxyModel::QgsProcessingToolboxProxyModel ( QObject * parent = nullptr,
QgsProcessingRegistry * registry = nullptr,
QgsProcessingRecentAlgorithmLog * recentLog = nullptr,
QgsProcessingFavoriteAlgorithmManager * favoriteManager = nullptr )
explicit

Constructor for QgsProcessingToolboxProxyModel, 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 826 of file qgsprocessingtoolboxmodel.cpp.

Member Function Documentation

◆ data()

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

Definition at line 1142 of file qgsprocessingtoolboxmodel.cpp.

◆ filterAcceptsRow()

bool QgsProcessingToolboxProxyModel::filterAcceptsRow ( int sourceRow,
const QModelIndex & sourceParent ) const
override

Definition at line 888 of file qgsprocessingtoolboxmodel.cpp.

◆ filters()

Filters QgsProcessingToolboxProxyModel::filters ( ) const
inline

Returns any filters that affect how toolbox content is filtered.

See also
setFilters()

Definition at line 585 of file qgsprocessingtoolboxmodel.h.

◆ filterString()

QString QgsProcessingToolboxProxyModel::filterString ( ) const
inline

Returns the current filter string, if set.

See also
setFilterString()

Definition at line 636 of file qgsprocessingtoolboxmodel.h.

◆ lessThan()

bool QgsProcessingToolboxProxyModel::lessThan ( const QModelIndex & left,
const QModelIndex & right ) const
override

Definition at line 1090 of file qgsprocessingtoolboxmodel.cpp.

◆ setFilterOutput()

void QgsProcessingToolboxProxyModel::setFilterOutput ( const QgsProcessingOutputDefinition * outputDefinition)

Sets an outputDefinition, such that only algorithms which are compatible with the specified output definition will be shown.

Ownership is not transferred.

Note
Use in conjunction with Filter::ForSocketOutput, useless with Filter::ForSocketInput.
Warning
This option is mutually exclusive with setFilterParameter() – if both are specified, only the last will be applied
See also
setFilterParameter()
Since
QGIS 4.4

Definition at line 879 of file qgsprocessingtoolboxmodel.cpp.

◆ setFilterParameter()

void QgsProcessingToolboxProxyModel::setFilterParameter ( const QgsProcessingParameterDefinition * parameterDefinition)

Sets a parameterDefinition, such that only algorithms or parameters which are compatible with the specified parameter definition will be shown.

Ownership is not transferred.

Note
Use in conjunction with Filter::ForSocketOutput or Filter::ForSocketInput.
Warning
This option is mutually exclusive with setFilterOutput() – if both are specified, only the last will be applied
See also
setFilterOutput()
Since
QGIS 4.4

Definition at line 871 of file qgsprocessingtoolboxmodel.cpp.

◆ setFilters()

void QgsProcessingToolboxProxyModel::setFilters ( QgsProcessingToolboxProxyModel::Filters filters)

Set filters that affect how toolbox content is filtered.

See also
filters()

Definition at line 852 of file qgsprocessingtoolboxmodel.cpp.

◆ setFilterString()

void QgsProcessingToolboxProxyModel::setFilterString ( const QString & filter)

Sets a filter string, such that only algorithms matching the specified string will be shown.

Matches are performed using a variety of tests, including checking against the algorithm name, short description, tags, etc.

See also
filterString()

Definition at line 865 of file qgsprocessingtoolboxmodel.cpp.

◆ setInPlaceLayer()

void QgsProcessingToolboxProxyModel::setInPlaceLayer ( QgsVectorLayer * layer)

Sets the vector layer for in-place algorithm filter.

Definition at line 858 of file qgsprocessingtoolboxmodel.cpp.

◆ toolboxModel() [1/2]

QgsProcessingToolboxModel * QgsProcessingToolboxProxyModel::toolboxModel ( )

Returns the underlying source Processing toolbox model.

Definition at line 842 of file qgsprocessingtoolboxmodel.cpp.

◆ toolboxModel() [2/2]

const QgsProcessingToolboxModel * QgsProcessingToolboxProxyModel::toolboxModel ( ) const

Returns the underlying source Processing toolbox model.

Note
Not available in Python bindings

Definition at line 847 of file qgsprocessingtoolboxmodel.cpp.


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