QGIS API Documentation 4.3.0-Master (c4ac42b33b7)
Loading...
Searching...
No Matches
QgsProcessingGuiRegistry Class Reference

A registry for widgets for use with the Processing framework. More...

#include <qgsprocessingguiregistry.h>

Inheritance diagram for QgsProcessingGuiRegistry:

Public Member Functions

 QgsProcessingGuiRegistry ()
 Constructor.
 ~QgsProcessingGuiRegistry () override
void addAlgorithmConfigurationWidgetFactory (QgsProcessingAlgorithmConfigurationWidgetFactory *factory)
 Add a new configuration widget factory for customized algorithm configuration widgets.
bool addParameterWidgetFactory (QgsProcessingParameterWidgetFactoryInterface *factory)
 Adds a parameter widget factory to the registry, allowing widget creation for parameters of the matching type via createParameterWidgetWrapper() and createModelerParameterWidget().
QgsProcessingAlgorithmConfigurationWidgetalgorithmConfigurationWidget (const QgsProcessingAlgorithm *algorithm) const
 Gets the configuration widget for an algorithm.
QgsProcessingModelConfigWidgetcreateModelConfigWidgetForComponent (QgsProcessingModelComponent *component, QgsProcessingContext &context, const QgsProcessingParameterWidgetContext &widgetContext) const
 Creates a new widget for configuring a Processing model component.
QgsProcessingModelerParameterWidgetcreateModelerParameterWidget (QgsProcessingModelAlgorithm *model, const QString &childId, const QgsProcessingParameterDefinition *parameter, QgsProcessingContext &context)
 Creates a new modeler parameter widget for the given parameter.
QgsProcessingAbstractParameterDefinitionWidgetcreateParameterDefinitionWidget (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 parameter type.
QgsAbstractProcessingParameterWidgetWrappercreateParameterWidgetWrapper (const QgsProcessingParameterDefinition *parameter, Qgis::ProcessingMode type)
 Creates a new parameter widget wrapper for the given parameter.
QgsProcessingParameterWidgetContext createWidgetContext () override
 Register a Processing widget context.
void registerModelConfigWidgetFactory (QgsProcessingModelConfigWidgetFactory *factory)
 Register a new factory class for creating panel widgets that can be shown in the Processing model designer dialog.
void registerWidgetContextGenerator (QgsProcessingWidgetContextGenerator *generator)
 Register a Processing widget context generator class that will be used to retrieve a widget context when required.
void removeAlgorithmConfigurationWidgetFactory (QgsProcessingAlgorithmConfigurationWidgetFactory *factory)
 Remove a configuration widget factory for customized algorithm configuration widgets.
void removeParameterWidgetFactory (QgsProcessingParameterWidgetFactoryInterface *factory)
 Removes a parameter widget factory from the registry.
void unregisterModelConfigWidgetFactory (QgsProcessingModelConfigWidgetFactory *factory)
 Unregister a previously registered factory for creating panel widgets that can be shown in the Processing model designer dialog.
Public Member Functions inherited from QgsProcessingWidgetContextGenerator
virtual ~QgsProcessingWidgetContextGenerator ()=default

Detailed Description

A registry for widgets for use with the Processing framework.

QgsProcessingGuiRegistry is not usually directly created, but rather accessed through QgsGui::processingGuiRegistry().

Since
QGIS 3.2

Definition at line 49 of file qgsprocessingguiregistry.h.

Constructor & Destructor Documentation

◆ QgsProcessingGuiRegistry()

QgsProcessingGuiRegistry::QgsProcessingGuiRegistry ( )

Constructor.

Should never be called manually, is already created by QgsGui.

Definition at line 47 of file qgsprocessingguiregistry.cpp.

◆ ~QgsProcessingGuiRegistry()

QgsProcessingGuiRegistry::~QgsProcessingGuiRegistry ( )
override

Definition at line 116 of file qgsprocessingguiregistry.cpp.

Member Function Documentation

◆ addAlgorithmConfigurationWidgetFactory()

void QgsProcessingGuiRegistry::addAlgorithmConfigurationWidgetFactory ( QgsProcessingAlgorithmConfigurationWidgetFactory * factory)

Add a new configuration widget factory for customized algorithm configuration widgets.

Ownership is taken.

Since
QGIS 3.2

Definition at line 129 of file qgsprocessingguiregistry.cpp.

◆ addParameterWidgetFactory()

bool QgsProcessingGuiRegistry::addParameterWidgetFactory ( QgsProcessingParameterWidgetFactoryInterface * factory)

Adds a parameter widget factory to the registry, allowing widget creation for parameters of the matching type via createParameterWidgetWrapper() and createModelerParameterWidget().

Ownership of factory is transferred to the registry.

Returns true if the factory was successfully added, or false if the factory could not be added. Each factory must return a unique value for QgsProcessingParameterWidgetFactoryInterface::parameterType(), and attempting to add a new factory with a duplicate type will result in failure.

See also
removeParameterWidgetFactory()
createParameterWidgetWrapper()
createModelerParameterWidget()
Since
QGIS 3.4

Definition at line 156 of file qgsprocessingguiregistry.cpp.

◆ algorithmConfigurationWidget()

QgsProcessingAlgorithmConfigurationWidget * QgsProcessingGuiRegistry::algorithmConfigurationWidget ( const QgsProcessingAlgorithm * algorithm) const

Gets the configuration widget for an algorithm.

This widget will be shown next to parameter widgets. Most algorithms do not have a configuration widget and in this case, nullptr will be returned.

Since
QGIS 3.2

Definition at line 140 of file qgsprocessingguiregistry.cpp.

◆ createModelConfigWidgetForComponent()

QgsProcessingModelConfigWidget * QgsProcessingGuiRegistry::createModelConfigWidgetForComponent ( QgsProcessingModelComponent * component,
QgsProcessingContext & context,
const QgsProcessingParameterWidgetContext & widgetContext ) const

Creates a new widget for configuring a Processing model component.

May return nullptr if configuring a the component is not supported.

Warning
Not stable API
Since
QGIS 4.0

Definition at line 234 of file qgsprocessingguiregistry.cpp.

◆ createModelerParameterWidget()

QgsProcessingModelerParameterWidget * QgsProcessingGuiRegistry::createModelerParameterWidget ( QgsProcessingModelAlgorithm * model,
const QString & childId,
const QgsProcessingParameterDefinition * parameter,
QgsProcessingContext & context )

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.

The caller takes ownership of the returned widget. If no factory is registered which handles the given parameter, nullptr will be returned.

See also
createParameterWidgetWrapper()
addParameterWidgetFactory()
Since
QGIS 3.4

Definition at line 208 of file qgsprocessingguiregistry.cpp.

◆ createParameterDefinitionWidget()

QgsProcessingAbstractParameterDefinitionWidget * QgsProcessingGuiRegistry::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 parameter type.

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 an existing parameter definition which will be reflected in the initial state of the returned widget. If definition is nullptr, then the returned widget will use default settings instead.

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

If nullptr is returned for a particular parameter type, it indicates that the parameter type cannot be configured via GUI.

Since
QGIS 3.10

Definition at line 223 of file qgsprocessingguiregistry.cpp.

◆ createParameterWidgetWrapper()

QgsAbstractProcessingParameterWidgetWrapper * QgsProcessingGuiRegistry::createParameterWidgetWrapper ( const QgsProcessingParameterDefinition * parameter,
Qgis::ProcessingMode type )

Creates a new parameter widget wrapper for the given parameter.

The type argument dictates the type of dialog the wrapper should be created for. The caller takes ownership of the returned wrapper.

If no factory is registered which handles the given parameter, nullptr will be returned.

See also
createModelerParameterWidget()
addParameterWidgetFactory()
Since
QGIS 3.4

Definition at line 190 of file qgsprocessingguiregistry.cpp.

◆ createWidgetContext()

QgsProcessingParameterWidgetContext QgsProcessingGuiRegistry::createWidgetContext ( )
overridevirtual

Register a Processing widget context.

Note
This returns a "top-level", application widget context with knowledge of the application map canvas, active project, etc. Individual Processing GUI subcomponents may start with this context, then further refine with lower-level specific components (such as individual model-specific properties)
See also
createWidgetContext()
Since
QGIS 4.4

Implements QgsProcessingWidgetContextGenerator.

Definition at line 258 of file qgsprocessingguiregistry.cpp.

◆ registerModelConfigWidgetFactory()

void QgsProcessingGuiRegistry::registerModelConfigWidgetFactory ( QgsProcessingModelConfigWidgetFactory * factory)

Register a new factory class for creating panel widgets that can be shown in the Processing model designer dialog.

Note
Ownership of the factory is not transferred, and the factory must be unregistered when plugin is unloaded.
See also
unregisterModelConfigWidgetFactory()
Warning
Not stable API
Since
QGIS 4.0

Definition at line 180 of file qgsprocessingguiregistry.cpp.

◆ registerWidgetContextGenerator()

void QgsProcessingGuiRegistry::registerWidgetContextGenerator ( QgsProcessingWidgetContextGenerator * generator)

Register a Processing widget context generator class that will be used to retrieve a widget context when required.

Note
This is intended for registration of a "top-level", application widget generator which can return contexts with knowledge of the application map canvas, active project, etc.
Warning
The generator must live for the lifetime of the application, or this method must explicitly be called with a nullptr argument to de-register the generator.
See also
createWidgetContext()
Since
QGIS 4.4

Definition at line 253 of file qgsprocessingguiregistry.cpp.

◆ removeAlgorithmConfigurationWidgetFactory()

void QgsProcessingGuiRegistry::removeAlgorithmConfigurationWidgetFactory ( QgsProcessingAlgorithmConfigurationWidgetFactory * factory)

Remove a configuration widget factory for customized algorithm configuration widgets.

Since
QGIS 3.2

Definition at line 134 of file qgsprocessingguiregistry.cpp.

◆ removeParameterWidgetFactory()

void QgsProcessingGuiRegistry::removeParameterWidgetFactory ( QgsProcessingParameterWidgetFactoryInterface * factory)

Removes a parameter widget factory from the registry.

The factory will be deleted.

See also
addParameterWidgetFactory()
Since
QGIS 3.4

Definition at line 171 of file qgsprocessingguiregistry.cpp.

◆ unregisterModelConfigWidgetFactory()

void QgsProcessingGuiRegistry::unregisterModelConfigWidgetFactory ( QgsProcessingModelConfigWidgetFactory * factory)

Unregister a previously registered factory for creating panel widgets that can be shown in the Processing model designer dialog.

Warning
Not stable API
See also
registerModelConfigWidgetFactory()
Since
QGIS 4.0

Definition at line 185 of file qgsprocessingguiregistry.cpp.


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