QGIS API Documentation 3.37.0-Master (fdefdf9c27f)
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
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}
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
const QgsProcessingAlgorithm * algorithm() const
Returns the algorithm instance associated with this widget.
const QgsProcessingParameterWidgetContext & widgetContext() const
Returns the context in which the Processing algorithm widget is shown, e.g., the parent model algorit...
QgsExpressionContext createExpressionContext() const override
This method needs to be reimplemented in all classes which implement this interface and return an exp...
void setAlgorithm(const QgsProcessingAlgorithm *algorithm)
Sets the algorithm instance associated with the widget.
QgsProcessingAlgorithmConfigurationWidget(QWidget *parent=nullptr)
Creates a new QgsProcessingAlgorithmConfigurationWidget.
void registerProcessingContextGenerator(QgsProcessingContextGenerator *generator)
Registers a Processing context generator class that will be used to retrieve a Processing context for...
virtual void setWidgetContext(const QgsProcessingParameterWidgetContext &context)
Sets the context in which the Processing algorithm widget is shown, e.g., the parent model algorithm,...
Abstract base class for processing algorithms.
An interface for objects which can create Processing contexts.
Contains settings which reflect the context in which a Processing parameter widget is shown,...
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