QGIS API Documentation 3.28.0-Firenze (ed3ad0430f)
Public Member Functions | Protected Member Functions | List of all members
QgsProcessingParameterWidgetFactoryInterface Class Referenceabstract

An interface for Processing widget wrapper factories. More...

#include <qgsprocessingwidgetwrapper.h>

Public Member Functions

virtual ~QgsProcessingParameterWidgetFactoryInterface ()=default
 
virtual QgsProcessingModelerParameterWidgetcreateModelerWidgetWrapper (QgsProcessingModelAlgorithm *model, const QString &childId, const QgsProcessingParameterDefinition *parameter, QgsProcessingContext &context)
 Creates a new modeler parameter widget for the given parameter. More...
 
virtual QgsProcessingAbstractParameterDefinitionWidgetcreateParameterDefinitionWidget (QgsProcessingContext &context, const QgsProcessingParameterWidgetContext &widgetContext, const QgsProcessingParameterDefinition *definition=nullptr, const QgsProcessingAlgorithm *algorithm=nullptr)
 Creates a new parameter definition widget allowing for configuration of an instance of the parameter type handled by this factory. More...
 
virtual QgsAbstractProcessingParameterWidgetWrappercreateWidgetWrapper (const QgsProcessingParameterDefinition *parameter, QgsProcessingGui::WidgetType type)=0
 Creates a new widget wrapper for the specified parameter definition. More...
 
virtual QString parameterType () const =0
 Returns the type string for the parameter type the factory is associated with. More...
 

Protected Member Functions

virtual QList< int > compatibleDataTypes (const QgsProcessingParameterDefinition *parameter) const
 Returns a list of compatible Processing data types for inputs for this widget for the specified parameter. More...
 
virtual QStringList compatibleOutputTypes () const =0
 Returns a list of compatible Processing output types for inputs for this parameter. More...
 
virtual QStringList compatibleParameterTypes () const =0
 Returns a list of compatible Processing parameter types for inputs for this parameter. More...
 
virtual QgsProcessingModelChildParameterSource::Source defaultModelSource (const QgsProcessingParameterDefinition *parameter) const
 Returns the default source type to use for the widget for the specified parameter. More...
 
virtual QString modelerExpressionFormatString () const
 Returns the expected expression format string for expression results for the parameter within model child algorithms. More...
 

Detailed Description

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.

Since
QGIS 3.4

Definition at line 532 of file qgsprocessingwidgetwrapper.h.

Constructor & Destructor Documentation

◆ ~QgsProcessingParameterWidgetFactoryInterface()

virtual QgsProcessingParameterWidgetFactoryInterface::~QgsProcessingParameterWidgetFactoryInterface ( )
virtualdefault

Member Function Documentation

◆ compatibleDataTypes()

QList< int > QgsProcessingParameterWidgetFactoryInterface::compatibleDataTypes ( const QgsProcessingParameterDefinition parameter) const
protectedvirtual

Returns a list of compatible Processing data types for inputs for this widget for the specified 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.

See also
compatibleParameterTypes()
compatibleOutputTypes()

Definition at line 387 of file qgsprocessingwidgetwrapper.cpp.

◆ compatibleOutputTypes()

virtual QStringList QgsProcessingParameterWidgetFactoryInterface::compatibleOutputTypes ( ) const
protectedpure virtual

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.

See also
compatibleParameterTypes()
compatibleDataTypes()

◆ compatibleParameterTypes()

virtual QStringList QgsProcessingParameterWidgetFactoryInterface::compatibleParameterTypes ( ) const
protectedpure virtual

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.

See also
compatibleOutputTypes()
compatibleDataTypes()

◆ createModelerWidgetWrapper()

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.

See also
createWidgetWrapper()

Definition at line 366 of file qgsprocessingwidgetwrapper.cpp.

◆ createParameterDefinitionWidget()

QgsProcessingAbstractParameterDefinitionWidget * QgsProcessingParameterWidgetFactoryInterface::createParameterDefinitionWidget ( QgsProcessingContext context,
const QgsProcessingParameterWidgetContext widgetContext,
const QgsProcessingParameterDefinition definition = nullptr,
const QgsProcessingAlgorithm algorithm = nullptr 
)
virtual

Creates a new parameter definition widget allowing for configuration of an instance of the parameter type handled by this factory.

The context argument must specify a Processing context, which will be used by the widget to evaluate existing definition properties such as default values. Similarly, the widgetContext argument specifies the wider GUI context in which the widget will be used.

The optional definition argument may specify a parameter definition which should be reflected in the initial state of the returned widget. Subclasses must ensure that they correctly handle both the case when a initial definition is passed, or when definition is nullptr (in which case sensible defaults should be shown in the returned widget).

Additionally, the optional algorithm parameter may be used to specify the algorithm or model associated with the parameter.

If a factory subclass returns nullptr for this method (i.e. as the base class implementation does), it indicates that the parameter type cannot be configured via GUI. In this case the parameter type will not be configurable when users add it as an input to their graphical models.

Since
QGIS 3.10

Definition at line 380 of file qgsprocessingwidgetwrapper.cpp.

◆ createWidgetWrapper()

virtual 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.

See also
createModelerWidgetWrapper()

◆ defaultModelSource()

QgsProcessingModelChildParameterSource::Source QgsProcessingParameterWidgetFactoryInterface::defaultModelSource ( const QgsProcessingParameterDefinition parameter) const
protectedvirtual

Returns the default source type to use for the widget for the specified parameter.

Since
QGIS 3.24

Definition at line 397 of file qgsprocessingwidgetwrapper.cpp.

◆ modelerExpressionFormatString()

QString QgsProcessingParameterWidgetFactoryInterface::modelerExpressionFormatString ( ) const
protectedvirtual

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.

Definition at line 392 of file qgsprocessingwidgetwrapper.cpp.

◆ parameterType()

virtual QString QgsProcessingParameterWidgetFactoryInterface::parameterType ( ) const
pure virtual

Returns the type string for the parameter type the factory is associated with.


The documentation for this class was generated from the following files: