QgsProcessingRegistry class

Registry for various processing components, including providers, algorithms and various parameters and outputs.

QgsProcessingRegistry is not usually directly created, but rather accessed through QgsApplication::processingRegistry().

Constructors, destructors, conversion operators

QgsProcessingRegistry(QObject* parent = nullptr)
Constructor for QgsProcessingRegistry.
QgsProcessingRegistry(const QgsProcessingRegistry& other) deleted
Registry cannot be copied.

Public functions

auto addParameterType(QgsProcessingParameterType* type) -> bool
Register a new parameter type for processing.
auto addProvider(QgsProcessingProvider* provider) -> bool
Add a processing provider to the registry.
auto algorithmById(const QString& id) const -> const QgsProcessingAlgorithm*
Finds an algorithm by its ID.
auto algorithms() const -> QList<const QgsProcessingAlgorithm*>
Returns a list of all available algorithms from registered providers.
auto createAlgorithmById(const QString& id, const QVariantMap& configuration = QVariantMap()) const -> QgsProcessingAlgorithm*
Creates a new instance of an algorithm by its ID.
auto operator=(const QgsProcessingRegistry& other) -> QgsProcessingRegistry& deleted
Registry cannot be copied.
auto parameterType(const QString& id) const -> QgsProcessingParameterType*
Returns the parameter type registered for id.
auto parameterTypes() const -> QList<QgsProcessingParameterType*>
Returns a list with all known parameter types.
auto providerById(const QString& id) -> QgsProcessingProvider*
Returns a matching provider by provider ID.
auto providers() const -> QList<QgsProcessingProvider*>
Gets list of available providers.
void removeParameterType(QgsProcessingParameterType* type)
Unregister a custom parameter type from processing.
auto removeProvider(QgsProcessingProvider* provider) -> bool
Removes a provider implementation from the registry (the provider object is deleted).
auto removeProvider(const QString& providerId) -> bool
Removes a provider implementation from the registry (the provider object is deleted).

Signals

void parameterTypeAdded(QgsProcessingParameterType* type)
Emitted when a new parameter type has been added to the registry.
void parameterTypeRemoved(QgsProcessingParameterType* type)
Emitted when a parameter type has been removed from the registry and is about to be deleted.
void providerAdded(const QString& id)
Emitted when a provider has been added to the registry.
void providerRemoved(const QString& id)
Emitted when a provider is removed from the registry.

Function documentation

bool QgsProcessingRegistry::addParameterType(QgsProcessingParameterType* type)

Register a new parameter type for processing.

Ownership is transferred to the registry. Will emit parameterTypeAdded.

bool QgsProcessingRegistry::addProvider(QgsProcessingProvider* provider)

Add a processing provider to the registry.

Ownership of the provider is transferred to the registry, and the provider's parent will be set to the registry. Returns false if the provider could not be added (eg if a provider with a duplicate ID already exists in the registry). Adding a provider to the registry automatically triggers the providers QgsProcessingProvider::load() method to populate the provider with algorithms.

const QgsProcessingAlgorithm* QgsProcessingRegistry::algorithmById(const QString& id) const

Finds an algorithm by its ID.

If no matching algorithm is found, a nullptr is returned.

QList<const QgsProcessingAlgorithm*> QgsProcessingRegistry::algorithms() const

Returns a list of all available algorithms from registered providers.

QgsProcessingAlgorithm* QgsProcessingRegistry::createAlgorithmById(const QString& id, const QVariantMap& configuration = QVariantMap()) const

Creates a new instance of an algorithm by its ID.

If no matching algorithm is found, a nullptr is returned. Callers take responsibility for deleting the returned object.

The configuration argument allows passing of a map of configuration settings to the algorithm, allowing it to dynamically adjust its initialized parameters and outputs according to this configuration. This is generally used only for algorithms in a model, allowing them to adjust their behavior at run time according to some user configuration.

QgsProcessingParameterType* QgsProcessingRegistry::parameterType(const QString& id) const

Returns the parameter type registered for id.

QList<QgsProcessingParameterType*> QgsProcessingRegistry::parameterTypes() const

Returns a list with all known parameter types.

void QgsProcessingRegistry::removeParameterType(QgsProcessingParameterType* type)

Unregister a custom parameter type from processing.

The type will be deleted. Will emit parameterTypeRemoved.

bool QgsProcessingRegistry::removeProvider(QgsProcessingProvider* provider)

Removes a provider implementation from the registry (the provider object is deleted).

Returns false if the provider could not be removed (eg provider does not exist in the registry).

bool QgsProcessingRegistry::removeProvider(const QString& providerId)

Removes a provider implementation from the registry (the provider object is deleted).

Returns false if the provider could not be removed (eg provider does not exist in the registry).

void QgsProcessingRegistry::parameterTypeAdded(QgsProcessingParameterType* type) signal

Emitted when a new parameter type has been added to the registry.

void QgsProcessingRegistry::parameterTypeRemoved(QgsProcessingParameterType* type) signal

Emitted when a parameter type has been removed from the registry and is about to be deleted.