21 QgsProcessingToolboxTreeView::QgsProcessingToolboxTreeView( QWidget *parent,
23 QgsProcessingRecentAlgorithmLog *recentLog )
27 mToolboxModel = mModel->toolboxModel();
31 void QgsProcessingToolboxTreeView::setRegistry(
QgsProcessingRegistry *registry, QgsProcessingRecentAlgorithmLog *recentLog )
36 mModel->deleteLater();
42 mToolboxModel = mModel->toolboxModel();
44 mModel->deleteLater();
48 void QgsProcessingToolboxTreeView::setFilterString(
const QString &filter )
50 const QString text = filter.trimmed().toLower();
51 mModel->setFilterString( text );
52 if ( !text.isEmpty() )
55 if ( !selectedAlgorithm() )
58 QModelIndex firstVisibleIndex = findFirstVisibleAlgorithm( QModelIndex() );
59 if ( firstVisibleIndex.isValid() )
60 selectionModel()->setCurrentIndex( firstVisibleIndex, QItemSelectionModel::ClearAndSelect );
71 QModelIndex sourceIndex = mModel->mapToSource( index );
72 if ( mToolboxModel->isAlgorithm( sourceIndex ) )
80 if ( selectionModel()->hasSelection() )
82 QModelIndex index = selectionModel()->selectedIndexes().at( 0 );
83 return algorithmForIndex( index );
91 void QgsProcessingToolboxTreeView::setFilters( QgsProcessingToolboxProxyModel::Filters
filters )
93 mModel->setFilters( filters );
96 void QgsProcessingToolboxTreeView::setInPlaceLayer(
QgsVectorLayer *layer )
98 mModel->setInPlaceLayer( layer );
101 QModelIndex QgsProcessingToolboxTreeView::findFirstVisibleAlgorithm(
const QModelIndex &parent )
103 for (
int r = 0; r < mModel->
rowCount( parent ); ++r )
105 QModelIndex proxyIndex = mModel->
index( r, 0, parent );
106 QModelIndex sourceIndex = mModel->mapToSource( proxyIndex );
107 if ( mToolboxModel->isAlgorithm( sourceIndex ) )
110 QModelIndex index = findFirstVisibleAlgorithm( proxyIndex );
111 if ( index.isValid() )
114 return QModelIndex();
Abstract base class for processing algorithms.
Registry for various processing components, including providers, algorithms and various parameters an...
Represents a vector layer which manages a vector based data sets.