QgsProcessingParameterWidgetContext class

Contains settings which reflect the context in which a Processing parameter widget is shown, e.g., the parent model algorithm, a linked map canvas, and other relevant information which allows the widget to fine-tune its behavior.

Constructors, destructors, conversion operators

QgsProcessingParameterWidgetContext() defaulted
Constructor for QgsProcessingParameterWidgetContext.

Public functions

auto mapCanvas() const -> QgsMapCanvas*
Returns the map canvas associated with the widget.
auto model() const -> QgsProcessingModelAlgorithm*
Returns the model which the parameter widget is associated with.
auto modelChildAlgorithmId() const -> QString
Returns the child algorithm ID within the model which the parameter widget is associated with.
void setMapCanvas(QgsMapCanvas* canvas)
Sets the map canvas associated with the widget.
void setModel(QgsProcessingModelAlgorithm* model)
Sets the model which the parameter widget is associated with.
void setModelChildAlgorithmId(const QString& id)
Sets the child algorithm id within the model which the parameter widget is associated with.

Function documentation

QgsMapCanvas* QgsProcessingParameterWidgetContext::mapCanvas() const

Returns the map canvas associated with the widget.

QgsProcessingModelAlgorithm* QgsProcessingParameterWidgetContext::model() const

Returns the model which the parameter widget is associated with.

QString QgsProcessingParameterWidgetContext::modelChildAlgorithmId() const

Returns the child algorithm ID within the model which the parameter widget is associated with.

void QgsProcessingParameterWidgetContext::setMapCanvas(QgsMapCanvas* canvas)

Sets the map canvas associated with the widget.

This allows the widget to retrieve the current map scale and other properties from the canvas.

void QgsProcessingParameterWidgetContext::setModel(QgsProcessingModelAlgorithm* model)

Sets the model which the parameter widget is associated with.

void QgsProcessingParameterWidgetContext::setModelChildAlgorithmId(const QString& id)

Sets the child algorithm id within the model which the parameter widget is associated with.