QGIS API Documentation  3.2.0-Bonn (bc43194)
qgsprocessingguiregistry.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  qgsprocessingguiregistry.cpp
3  ---------------------
4  begin : April 2018
5  copyright : (C) 2018 by Matthias Kuhn
6  email : [email protected]
7  ***************************************************************************/
8 
9 /***************************************************************************
10  * *
11  * This program is free software; you can redistribute it and/or modify *
12  * it under the terms of the GNU General Public License as published by *
13  * the Free Software Foundation; either version 2 of the License, or *
14  * (at your option) any later version. *
15  * *
16  ***************************************************************************/
17 
21 #include "qgis.h"
22 
24 {
25  addAlgorithmConfigurationWidgetFactory( new QgsFilterAlgorithmConfigurationWidgetFactory() );
26 }
27 
29 {
30  for ( QgsProcessingAlgorithmConfigurationWidgetFactory *factory : qgis::as_const( mAlgorithmConfigurationWidgetFactories ) )
32 }
33 
35 {
36  mAlgorithmConfigurationWidgetFactories.append( factory );
37 }
38 
40 {
41  mAlgorithmConfigurationWidgetFactories.removeAll( factory );
42  delete factory;
43 }
44 
46 {
47  for ( const auto *factory : mAlgorithmConfigurationWidgetFactories )
48  {
49  if ( factory->canCreateFor( algorithm ) )
50  {
51  return factory->create( algorithm );
52  }
53  }
54 
55  return nullptr;
56 }
Abstract base class for processing algorithms.
As part of the API refactoring and improvements which landed in the Processing API was substantially reworked from the x version This was done in order to allow much of the underlying Processing framework to be ported into allowing algorithms to be written in pure substantial changes are required in order to port existing x Processing algorithms for QGIS x The most significant changes are outlined not GeoAlgorithm For algorithms which operate on features one by consider subclassing the QgsProcessingFeatureBasedAlgorithm class This class allows much of the boilerplate code for looping over features from a vector layer to be bypassed and instead requires implementation of a processFeature method Ensure that your algorithm(or algorithm 's parent class) implements the new pure virtual createInstance(self) call
QgsProcessingAlgorithmConfigurationWidget * algorithmConfigurationWidget(const QgsProcessingAlgorithm *algorithm) const
Gets the configuration widget for an algorithm.
void addAlgorithmConfigurationWidgetFactory(QgsProcessingAlgorithmConfigurationWidgetFactory *factory)
Add a new configuration widget factory for customized algorithm configuration widgets.
Interface base class for factories for algorithm configuration widgets.
A configuration widget for processing algorithms allows providing additional configuration options di...
void removeAlgorithmConfigurationWidgetFactory(QgsProcessingAlgorithmConfigurationWidgetFactory *factory)
Remove a configuration widget factory for customized algorithm configuration widgets.