89 const QList< QgsProcessingAlgorithmConfigurationWidgetFactory * > factories = mAlgorithmConfigurationWidgetFactories;
92 const QMap< QString, QgsProcessingParameterWidgetFactoryInterface * > paramFactories = mParameterWidgetFactories;
93 for (
auto it = paramFactories.constBegin(); it != paramFactories.constEnd(); ++it )
99 mAlgorithmConfigurationWidgetFactories.append( factory );
104 mAlgorithmConfigurationWidgetFactories.removeAll( factory );
110 for (
const auto *factory : mAlgorithmConfigurationWidgetFactories )
112 if ( factory->canCreateFor(
algorithm ) )
114 std::unique_ptr< QgsProcessingAlgorithmConfigurationWidget > widget( factory->create(
algorithm ) );
117 return widget.release();
129 if ( mParameterWidgetFactories.contains( factory->
parameterType() ) )
135 mParameterWidgetFactories.insert( factory->
parameterType(), factory );
144 mParameterWidgetFactories.remove( factory->
parameterType() );
153 const QString parameterType = parameter->
type();
154 if ( !mParameterWidgetFactories.contains( parameterType ) )
157 return mParameterWidgetFactories.value( parameterType )->createWidgetWrapper( parameter, type );
165 const QString parameterType = parameter->
type();
166 if ( !mParameterWidgetFactories.contains( parameterType ) )
169 return mParameterWidgetFactories.value( parameterType )->createModelerWidgetWrapper( model, childId, parameter, context );
178 if ( !mParameterWidgetFactories.contains( type ) )
181 return mParameterWidgetFactories.value( type )->createParameterDefinitionWidget( context, widgetContext, definition,
algorithm );
static void warning(const QString &msg)
Goes to qWarning.
Abstract base class for processing algorithms.
Contains information about the context in which a processing algorithm is executed.
void addAlgorithmConfigurationWidgetFactory(QgsProcessingAlgorithmConfigurationWidgetFactory *factory)
Add a new configuration widget factory for customized algorithm configuration widgets.
QgsAbstractProcessingParameterWidgetWrapper * createParameterWidgetWrapper(const QgsProcessingParameterDefinition *parameter, QgsProcessingGui::WidgetType type)
Creates a new parameter widget wrapper for the given parameter.
bool addParameterWidgetFactory(QgsProcessingParameterWidgetFactoryInterface *factory)
Adds a parameter widget factory to the registry, allowing widget creation for parameters of the match...
QgsProcessingGuiRegistry()
Constructor.
void removeAlgorithmConfigurationWidgetFactory(QgsProcessingAlgorithmConfigurationWidgetFactory *factory)
Remove a configuration widget factory for customized algorithm configuration widgets.
~QgsProcessingGuiRegistry()
QgsProcessingAlgorithmConfigurationWidget * algorithmConfigurationWidget(const QgsProcessingAlgorithm *algorithm) const
Gets the configuration widget for an algorithm.
QgsProcessingAbstractParameterDefinitionWidget * createParameterDefinitionWidget(const QString &type, 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 a specific par...
QgsProcessingModelerParameterWidget * createModelerParameterWidget(QgsProcessingModelAlgorithm *model, const QString &childId, const QgsProcessingParameterDefinition *parameter, QgsProcessingContext &context)
Creates a new modeler parameter widget for the given parameter.
void removeParameterWidgetFactory(QgsProcessingParameterWidgetFactoryInterface *factory)
Removes a parameter widget factory from the registry.
WidgetType
Types of dialogs which Processing widgets can be created for.
Base class for the definition of processing parameters.
virtual QString type() const =0
Unique parameter type name.
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