23QgsProcessingToolboxTreeView::QgsProcessingToolboxTreeView( QWidget *parent,
25 QgsProcessingRecentAlgorithmLog *recentLog,
26 QgsProcessingFavoriteAlgorithmManager *favoriteManager )
30 mToolboxModel = mModel->toolboxModel();
34void QgsProcessingToolboxTreeView::setRegistry(
QgsProcessingRegistry *registry, QgsProcessingRecentAlgorithmLog *recentLog, QgsProcessingFavoriteAlgorithmManager *favoriteManager )
39 mModel->deleteLater();
47 mModel->deleteLater();
51void QgsProcessingToolboxTreeView::setFilterString(
const QString &filter )
53 const QString text = filter.trimmed().toLower();
55 if ( !text.isEmpty() )
58 if ( !selectedAlgorithm() )
61 const QModelIndex firstVisibleIndex = findFirstVisibleAlgorithm( QModelIndex() );
62 if ( firstVisibleIndex.isValid() )
63 selectionModel()->setCurrentIndex( firstVisibleIndex, QItemSelectionModel::ClearAndSelect );
74 const QModelIndex sourceIndex = mModel->mapToSource( index );
75 if ( mToolboxModel->isAlgorithm( sourceIndex ) )
76 return mToolboxModel->algorithmForIndex( sourceIndex );
83 if ( selectionModel()->hasSelection() )
85 const QModelIndex index = selectionModel()->selectedIndexes().at( 0 );
86 return algorithmForIndex( index );
96 mModel->setFilters( filters );
101 return mModel->filters();
104void QgsProcessingToolboxTreeView::setInPlaceLayer(
QgsVectorLayer *layer )
106 mModel->setInPlaceLayer( layer );
109QModelIndex QgsProcessingToolboxTreeView::findFirstVisibleAlgorithm(
const QModelIndex &parent )
111 for (
int r = 0; r < mModel->rowCount( parent ); ++r )
113 QModelIndex proxyIndex = mModel->index( r, 0, parent );
114 const QModelIndex sourceIndex = mModel->mapToSource( proxyIndex );
115 if ( mToolboxModel->isAlgorithm( sourceIndex ) )
118 QModelIndex index = findFirstVisibleAlgorithm( proxyIndex );
119 if ( index.isValid() )
122 return QModelIndex();
125void QgsProcessingToolboxTreeView::keyPressEvent( QKeyEvent *event )
127 if ( event->key() == Qt::Key_Return || event->key() == Qt::Key_Enter )
128 emit doubleClicked( currentIndex() );
130 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.