QgsProcessingParameterWidgetFactoryInterface class

An interface for Processing widget wrapper factories.

Widget wrapper factories allow creation of QgsAbstractProcessingParameterWidgetWrapper objects. They are centrally managed by QgsProcessingGuiRegistry. Usually, individual factories are not directly utilized, rather the QgsGui::processingGuiRegistry()->createParameterWidgetWrapper() method is used to create widget wrappers.

Public functions

auto createModelerWidgetWrapper(QgsProcessingModelAlgorithm* model, const QString& childId, const QgsProcessingParameterDefinition* parameter, QgsProcessingContext& context) -> QgsProcessingModelerParameterWidget* virtual
Creates a new modeler parameter widget for the given parameter.
auto createWidgetWrapper(const QgsProcessingParameterDefinition* parameter, QgsProcessingGui::WidgetType type) -> QgsAbstractProcessingParameterWidgetWrapper* pure virtual
Creates a new widget wrapper for the specified parameter definition.
auto parameterType() const -> QString pure virtual
Returns the type string for the parameter type the factory is associated with.

Protected functions

auto compatibleDataTypes() const -> QList<int> pure virtual
Returns a list of compatible Processing data types for inputs for this parameter.
auto compatibleOutputTypes() const -> QStringList pure virtual
Returns a list of compatible Processing output types for inputs for this parameter.
auto compatibleParameterTypes() const -> QStringList pure virtual
Returns a list of compatible Processing parameter types for inputs for this parameter.
auto modelerExpressionFormatString() const -> QString virtual
Returns the expected expression format string for expression results for the parameter within model child algorithms.

Function documentation

QgsProcessingModelerParameterWidget* QgsProcessingParameterWidgetFactoryInterface::createModelerWidgetWrapper(QgsProcessingModelAlgorithm* model, const QString& childId, const QgsProcessingParameterDefinition* parameter, QgsProcessingContext& context) virtual

Creates a new modeler parameter widget for the given parameter.

This widget allows configuration of the parameter's value when used inside a Processing 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.

QgsAbstractProcessingParameterWidgetWrapper* QgsProcessingParameterWidgetFactoryInterface::createWidgetWrapper(const QgsProcessingParameterDefinition* parameter, QgsProcessingGui::WidgetType type) pure virtual

Creates a new widget wrapper for the specified parameter definition.

The type argument indicates the dialog type to create a wrapper for.

QList<int> QgsProcessingParameterWidgetFactoryInterface::compatibleDataTypes() const pure virtual protected

Returns a list of compatible Processing data types for inputs for this parameter.

In order to determine the available sources for the parameter in a model the types returned by this method are checked. The returned list corresponds to the various available values from QgsProcessing::SourceType.

Subclasses should return a list of all QgsProcessing::SourceType values which can be used as values for the parameter.

QStringList QgsProcessingParameterWidgetFactoryInterface::compatibleOutputTypes() const pure virtual protected

Returns a list of compatible Processing output types for inputs for this parameter.

In order to determine the available sources for the parameter in a model the types returned by this method are checked. The returned list corresponds to the various available values for QgsProcessingOutputDefinition::type().

Subclasses should return a list of all QgsProcessingOutputDefinition::type() values which can be used as values for the parameter.

QStringList QgsProcessingParameterWidgetFactoryInterface::compatibleParameterTypes() const pure virtual protected

Returns a list of compatible Processing parameter types for inputs for this parameter.

In order to determine the available sources for the parameter in a model the types returned by this method are checked. The returned list corresponds to the various available values for QgsProcessingParameterDefinition::type().

Subclasses should return a list of all QgsProcessingParameterDefinition::type() values which can be used as input values for the parameter.

QString QgsProcessingParameterWidgetFactoryInterface::modelerExpressionFormatString() const virtual protected

Returns the expected expression format string for expression results for the parameter within model child algorithms.

This is shown in modeler widget wrappers when using the "pre-calculated" expression mode, and should give helpful text to users to indicate the expected results from the expression.

This is purely a text format and no expression validation is made against it.