QgsProcessingOutputLayerDefinition class

Encapsulates settings relating to a feature sink or output raster layer for a processing algorithm.

Constructors, destructors, conversion operators

QgsProcessingOutputLayerDefinition(const QString& sink = QString(), QgsProject* destinationProject = nullptr)
Constructor for QgsProcessingOutputLayerDefinition, accepting a static sink/layer string.
QgsProcessingOutputLayerDefinition(const QgsProperty& sink, QgsProject* destinationProject = nullptr)
Constructor for QgsProcessingOutputLayerDefinition, accepting a QgsProperty sink/layer.
operator QVariant() const
Allows direct construction of QVariants.

Public functions

auto loadVariant(const QVariantMap& map) -> bool
Loads this output layer definition from a QVariantMap, wrapped in a QVariant.
auto toVariant() const -> QVariant
Saves this output layer definition to a QVariantMap, wrapped in a QVariant.

Public variables

QVariantMap createOptions
Map of optional sink/layer creation options, which are passed to the underlying provider when creating new layers.
QString destinationName
Name to use for sink if it's to be loaded into a destination project.
QgsProject* destinationProject
Destination project.
QgsProperty sink
Sink/layer definition.

Function documentation

QgsProcessingOutputLayerDefinition::QgsProcessingOutputLayerDefinition(const QString& sink = QString(), QgsProject* destinationProject = nullptr)

Constructor for QgsProcessingOutputLayerDefinition, accepting a static sink/layer string.

The destinationProject parameter can be set to a QgsProject instance in which to automatically load the resulting sink/layer after completing processing.

QgsProcessingOutputLayerDefinition::QgsProcessingOutputLayerDefinition(const QgsProperty& sink, QgsProject* destinationProject = nullptr)

Constructor for QgsProcessingOutputLayerDefinition, accepting a QgsProperty sink/layer.

The destinationProject parameter can be set to a QgsProject instance in which to automatically load the resulting sink/layer after completing processing.

bool QgsProcessingOutputLayerDefinition::loadVariant(const QVariantMap& map)

Loads this output layer definition from a QVariantMap, wrapped in a QVariant.

You can use QgsXmlUtils::readVariant to load it from an XML document.

QVariant QgsProcessingOutputLayerDefinition::toVariant() const

Saves this output layer definition to a QVariantMap, wrapped in a QVariant.

You can use QgsXmlUtils::writeVariant to save it to an XML document.

Variable documentation

QVariantMap QgsProcessingOutputLayerDefinition::createOptions

Map of optional sink/layer creation options, which are passed to the underlying provider when creating new layers.

Known options also include 'fileEncoding', which is used to specify a file encoding to use for created files.

QgsProject* QgsProcessingOutputLayerDefinition::destinationProject

Destination project.

Can be set to a QgsProject instance in which to automatically load the resulting sink/layer after completing processing. The default behavior is not to load the result into any project (nullptr).

QgsProperty QgsProcessingOutputLayerDefinition::sink

Sink/layer definition.

Usually a static property set to the destination file name for the sink's layer.