QGIS API Documentation  3.16.0-Hannover (43b64b13f3)
qgsprocessingalgorithmconfigurationwidget.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  qgsprocessingalgorithmconfig.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 
19 
21  : QWidget( parent )
22 {
23 }
24 
26 {
27  mWidgetContext = context;
28 }
29 
31 {
32  return mWidgetContext;
33 }
34 
36 {
37  mAlgorithm = algorithm;
38 }
39 
41 {
42  mContextGenerator = generator;
43 }
44 
46 {
47  return QgsProcessingGuiUtils::createExpressionContext( mContextGenerator, mWidgetContext, mAlgorithm, nullptr );
48 }
QgsExpressionContext
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
Definition: qgsexpressioncontext.h:370
QgsProcessingParameterWidgetContext
Contains settings which reflect the context in which a Processing parameter widget is shown,...
Definition: qgsprocessingwidgetwrapper.h:100
algorithm
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::createExpressionContext
QgsExpressionContext createExpressionContext() const override
This method needs to be reimplemented in all classes which implement this interface and return an exp...
Definition: qgsprocessingalgorithmconfigurationwidget.cpp:45
QgsProcessingAlgorithmConfigurationWidget::algorithm
const QgsProcessingAlgorithm * algorithm() const
Returns the algorithm instance associated with this widget.
Definition: qgsprocessingalgorithmconfigurationwidget.h:98
QgsProcessingAlgorithmConfigurationWidget::setAlgorithm
void setAlgorithm(const QgsProcessingAlgorithm *algorithm)
Sets the algorithm instance associated with the widget.
Definition: qgsprocessingalgorithmconfigurationwidget.cpp:35
QgsProcessingAlgorithmConfigurationWidget::QgsProcessingAlgorithmConfigurationWidget
QgsProcessingAlgorithmConfigurationWidget(QWidget *parent=nullptr)
Creates a new QgsProcessingAlgorithmConfigurationWidget.
Definition: qgsprocessingalgorithmconfigurationwidget.cpp:20
QgsProcessingAlgorithmConfigurationWidget::registerProcessingContextGenerator
void registerProcessingContextGenerator(QgsProcessingContextGenerator *generator)
Registers a Processing context generator class that will be used to retrieve a Processing context for...
Definition: qgsprocessingalgorithmconfigurationwidget.cpp:40
qgsprocessingalgorithmconfigurationwidget.h
QgsProcessingAlgorithmConfigurationWidget::setWidgetContext
virtual void setWidgetContext(const QgsProcessingParameterWidgetContext &context)
Sets the context in which the Processing algorithm widget is shown, e.g., the parent model algorithm,...
Definition: qgsprocessingalgorithmconfigurationwidget.cpp:25
QgsProcessingAlgorithm
Abstract base class for processing algorithms.
Definition: qgsprocessingalgorithm.h:52
QgsProcessingAlgorithmConfigurationWidget::widgetContext
const QgsProcessingParameterWidgetContext & widgetContext() const
Returns the context in which the Processing algorithm widget is shown, e.g., the parent model algorit...
Definition: qgsprocessingalgorithmconfigurationwidget.cpp:30
QgsProcessingContextGenerator
An interface for objects which can create Processing contexts.
Definition: qgsprocessingwidgetwrapper.h:53