23QgsProcessingToolboxTreeView::QgsProcessingToolboxTreeView( QWidget *parent,
25 QgsProcessingRecentAlgorithmLog *recentLog )
29 mToolboxModel = mModel->toolboxModel();
33void QgsProcessingToolboxTreeView::setRegistry(
QgsProcessingRegistry *registry, QgsProcessingRecentAlgorithmLog *recentLog )
38 mModel->deleteLater();
46 mModel->deleteLater();
50void QgsProcessingToolboxTreeView::setFilterString(
const QString &filter )
52 const QString text = filter.trimmed().toLower();
54 if ( !text.isEmpty() )
57 if ( !selectedAlgorithm() )
60 const QModelIndex firstVisibleIndex = findFirstVisibleAlgorithm( QModelIndex() );
61 if ( firstVisibleIndex.isValid() )
62 selectionModel()->setCurrentIndex( firstVisibleIndex, QItemSelectionModel::ClearAndSelect );
73 const QModelIndex sourceIndex = mModel->mapToSource( index );
74 if ( mToolboxModel->isAlgorithm( sourceIndex ) )
75 return mToolboxModel->algorithmForIndex( sourceIndex );
82 if ( selectionModel()->hasSelection() )
84 const QModelIndex index = selectionModel()->selectedIndexes().at( 0 );
85 return algorithmForIndex( index );
93void QgsProcessingToolboxTreeView::setFilters( QgsProcessingToolboxProxyModel::Filters filters )
95 mModel->setFilters( filters );
98QgsProcessingToolboxProxyModel::Filters QgsProcessingToolboxTreeView::filters()
const
100 return mModel->filters();
103void QgsProcessingToolboxTreeView::setInPlaceLayer(
QgsVectorLayer *layer )
105 mModel->setInPlaceLayer( layer );
108QModelIndex QgsProcessingToolboxTreeView::findFirstVisibleAlgorithm(
const QModelIndex &parent )
110 for (
int r = 0; r < mModel->rowCount( parent ); ++r )
112 QModelIndex proxyIndex = mModel->index( r, 0, parent );
113 const QModelIndex sourceIndex = mModel->mapToSource( proxyIndex );
114 if ( mToolboxModel->isAlgorithm( sourceIndex ) )
117 QModelIndex index = findFirstVisibleAlgorithm( proxyIndex );
118 if ( index.isValid() )
121 return QModelIndex();
124void QgsProcessingToolboxTreeView::keyPressEvent( QKeyEvent *event )
126 if ( event->key() == Qt::Key_Return || event->key() == Qt::Key_Enter )
127 emit doubleClicked( currentIndex() );
129 QTreeView::keyPressEvent( event );
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.