QGIS API Documentation
3.16.0-Hannover (43b64b13f3)
|
A widget for customising the value of Processing algorithm parameter inside a Processing model. More...
#include <qgsprocessingmodelerparameterwidget.h>
Public Member Functions | |
QgsProcessingModelerParameterWidget (QgsProcessingModelAlgorithm *model, const QString &childId, const QgsProcessingParameterDefinition *parameter, QgsProcessingContext &context, QWidget *parent=nullptr) | |
Constructor for QgsProcessingModelerParameterWidget, for the specified parameter definition within the given model. More... | |
~QgsProcessingModelerParameterWidget () override | |
QgsExpressionContext | createExpressionContext () const override |
This method needs to be reimplemented in all classes which implement this interface and return an expression context. More... | |
QLabel * | createLabel () |
Creates a label for use identifying the associated parameter. More... | |
bool | isModelOutput () const |
Returns true if the widget is set to the model output mode. More... | |
QString | modelOutputName () const |
Returns the model output name, if isModelOutput() is true . More... | |
const QgsProcessingParameterDefinition * | parameterDefinition () const |
Returns the parameter definition associated with this wrapper. More... | |
void | populateSources (const QStringList &compatibleParameterTypes, const QStringList &compatibleOutputTypes, const QList< int > &compatibleDataTypes) |
Populates the widget with available sources for the parameter's value, e.g. More... | |
void | registerProcessingContextGenerator (QgsProcessingContextGenerator *generator) |
Registers a Processing context generator class that will be used to retrieve a Processing context for the widget when required. More... | |
void | setDialog (QDialog *dialog) |
Sets the parent dialog in which the widget is shown. More... | |
void | setExpressionHelpText (const QString &text) |
Set the expected expression format text, which is shown in the expression builder dialog for the widget when in the "pre-calculated" expression mode. More... | |
void | setToModelOutput (const QString &value) |
Sets the widget to a model output, for destination parameters only. More... | |
void | setWidgetContext (const QgsProcessingParameterWidgetContext &context) |
Sets the context in which the modeler parameter widget is shown, e.g., the parent model algorithm and other relevant information which allows the widget to fine-tune its behavior. More... | |
virtual void | setWidgetValue (const QgsProcessingModelChildParameterSource &value) |
Sets the current value for the parameter. More... | |
void | setWidgetValue (const QList< QgsProcessingModelChildParameterSource > &values) |
Sets the current values for the parameter. More... | |
virtual QVariant | value () const |
Returns the current value of the parameter. More... | |
Public Member Functions inherited from QgsExpressionContextGenerator | |
virtual | ~QgsExpressionContextGenerator ()=default |
Friends | |
class | TestProcessingGui |
A widget for customising the value of Processing algorithm parameter inside a Processing model.
The widget provides choice of the linked source for values for the parameter inside the model. E.g. parameters can be a static value, an evaluated expression results, the output from another child algorithm, or an input parameter for the model itself.
Individual modeler parameter widgets are not usually created directly, instead they are constructed through the central registry, via calls to QgsGui::processingGuiRegistry()->createModelerParameterWidget().
Definition at line 61 of file qgsprocessingmodelerparameterwidget.h.
QgsProcessingModelerParameterWidget::QgsProcessingModelerParameterWidget | ( | QgsProcessingModelAlgorithm * | model, |
const QString & | childId, | ||
const QgsProcessingParameterDefinition * | parameter, | ||
QgsProcessingContext & | context, | ||
QWidget * | parent = nullptr |
||
) |
Constructor for QgsProcessingModelerParameterWidget, for the specified parameter definition within the given model.
The ID of the child algorithm within the model must be specified via the childId argument. This value corresponds to the QgsProcessingModelChildAlgorithm::childId() string, which uniquely identifies which child algorithm the parameter is associated with inside the given model.
A Processing context must also be specified, which allows the widget to resolve parameter values which are context dependent. The context must last for the lifetime of the widget.
Definition at line 37 of file qgsprocessingmodelerparameterwidget.cpp.
|
overridedefault |
|
overridevirtual |
This method needs to be reimplemented in all classes which implement this interface and return an expression context.
Implements QgsExpressionContextGenerator.
Definition at line 249 of file qgsprocessingmodelerparameterwidget.cpp.
QLabel * QgsProcessingModelerParameterWidget::createLabel | ( | ) |
Creates a label for use identifying the associated parameter.
The caller takes ownership of the returned value.
Definition at line 148 of file qgsprocessingmodelerparameterwidget.cpp.
bool QgsProcessingModelerParameterWidget::isModelOutput | ( | ) | const |
Returns true
if the widget is set to the model output mode.
Definition at line 192 of file qgsprocessingmodelerparameterwidget.cpp.
QString QgsProcessingModelerParameterWidget::modelOutputName | ( | ) | const |
Returns the model output name, if isModelOutput() is true
.
Definition at line 197 of file qgsprocessingmodelerparameterwidget.cpp.
const QgsProcessingParameterDefinition * QgsProcessingModelerParameterWidget::parameterDefinition | ( | ) | const |
Returns the parameter definition associated with this wrapper.
Definition at line 143 of file qgsprocessingmodelerparameterwidget.cpp.
void QgsProcessingModelerParameterWidget::populateSources | ( | const QStringList & | compatibleParameterTypes, |
const QStringList & | compatibleOutputTypes, | ||
const QList< int > & | compatibleDataTypes | ||
) |
Populates the widget with available sources for the parameter's value, e.g.
adding the available child algorithm outputs and model input parameter choices.
In order to determine the available source, the compatibleParameterTypes and compatibleOutputTypes arguments are used. These lists correspond to the various available values for QgsProcessingParameterDefinition::type() (for compatibleParameterTypes) and the values for QgsProcessingOutputDefinition::type() (for compatibleOutputTypes).
The compatibleDataTypes list corresponds to the compatible data types from QgsProcessing::SourceType.
Definition at line 390 of file qgsprocessingmodelerparameterwidget.cpp.
void QgsProcessingModelerParameterWidget::registerProcessingContextGenerator | ( | QgsProcessingContextGenerator * | generator | ) |
Registers a Processing context generator class that will be used to retrieve a Processing context for the widget when required.
Definition at line 137 of file qgsprocessingmodelerparameterwidget.cpp.
void QgsProcessingModelerParameterWidget::setDialog | ( | QDialog * | dialog | ) |
Sets the parent dialog in which the widget is shown.
Definition at line 243 of file qgsprocessingmodelerparameterwidget.cpp.
void QgsProcessingModelerParameterWidget::setExpressionHelpText | ( | const QString & | text | ) |
Set the expected expression format text, which is shown in the expression builder dialog for the widget when in the "pre-calculated" expression mode.
This is purely a text format and no expression validation is made against it.
Definition at line 428 of file qgsprocessingmodelerparameterwidget.cpp.
void QgsProcessingModelerParameterWidget::setToModelOutput | ( | const QString & | value | ) |
Sets the widget to a model output, for destination parameters only.
Definition at line 185 of file qgsprocessingmodelerparameterwidget.cpp.
void QgsProcessingModelerParameterWidget::setWidgetContext | ( | const QgsProcessingParameterWidgetContext & | context | ) |
Sets the context in which the modeler parameter widget is shown, e.g., the parent model algorithm and other relevant information which allows the widget to fine-tune its behavior.
Definition at line 131 of file qgsprocessingmodelerparameterwidget.cpp.
|
virtual |
Sets the current value for the parameter.
Definition at line 156 of file qgsprocessingmodelerparameterwidget.cpp.
void QgsProcessingModelerParameterWidget::setWidgetValue | ( | const QList< QgsProcessingModelChildParameterSource > & | values | ) |
Sets the current values for the parameter.
Definition at line 170 of file qgsprocessingmodelerparameterwidget.cpp.
|
virtual |
Returns the current value of the parameter.
Definition at line 202 of file qgsprocessingmodelerparameterwidget.cpp.
|
friend |
Definition at line 240 of file qgsprocessingmodelerparameterwidget.h.