Class: QgsVectorLayerExporterTask¶
QgsTask
task which performs a
QgsVectorLayerExporter
layer export operation as a
background task.
This can be used to export a vector layer out to a provider without blocking the QGIS interface.
See also
See also
Class Hierarchy¶
Base classes¶
Abstract base class for long running background tasks. |
|
Static Methods
Creates a new |
Signals
Emitted when an error occurs which prevented the layer being exported (or if the task is canceled). |
|
Emitted when exporting the layer is successfully completed. |
- class qgis.core.QgsVectorLayerExporterTask[source]¶
Bases:
QgsTask
- __init__(layer: QgsVectorLayer | None, uri: str | None, providerKey: str | None, destinationCrs: QgsCoordinateReferenceSystem, options: Dict[str | None, Any] = {}, ownsLayer: bool = False)
Constructor for QgsVectorLayerExporterTask. Takes a source
layer
, destinationuri
andproviderKey
, and various export related parameters such as destination CRS and exportoptions
.ownsLayer
has to be set toTrue
if the task should take ownership of the layer and delete it after export.- Parameters:
layer (Optional[QgsVectorLayer])
uri (Optional[str])
providerKey (Optional[str])
destinationCrs (QgsCoordinateReferenceSystem)
options (Dict[Optional[str], Any] = {})
ownsLayer (bool = False)
- __init__(layer: QgsVectorLayer | None, uri: str | None, providerKey: str | None, exportOptions: QgsVectorLayerExporter.ExportOptions, providerOptions: Dict[str | None, Any] = {}, ownsLayer: bool = False)
Constructor for QgsVectorLayerExporterTask. Takes a source
layer
, destinationuri
andproviderKey
, and various export related parameters via theexportOptions
argument.ownsLayer
has to be set toTrue
if the task should take ownership of the layer and delete it after export.Added in version 3.44.
- Parameters:
layer (Optional[QgsVectorLayer])
uri (Optional[str])
providerKey (Optional[str])
exportOptions (QgsVectorLayerExporter.ExportOptions)
providerOptions (Dict[Optional[str], Any] = {})
ownsLayer (bool = False)
- signal errorOccurred(error: Qgis.VectorExportResult, errorMessage: str)[source]¶
Emitted when an error occurs which prevented the layer being exported (or if the task is canceled). The export
error
anderrorMessage
will be reported.- Parameters:
error (Qgis.VectorExportResult)
errorMessage (str)
- static withLayerOwnership(layer: QgsVectorLayer | None, uri: str | None, providerKey: str | None, destinationCrs: QgsCoordinateReferenceSystem, options: Dict[str | None, Any] = {}) QgsVectorLayerExporterTask | None [source]¶
Creates a new
QgsVectorLayerExporterTask
which has ownership over a sourcelayer
. When the export task has completed (successfully or otherwise)layer
will be deleted. The destinationuri
andproviderKey
, and various export related parameters such as destination CRS and exportoptions
must be specified.- Parameters:
layer (Optional[QgsVectorLayer])
uri (Optional[str])
providerKey (Optional[str])
destinationCrs (QgsCoordinateReferenceSystem)
options (Dict[Optional[str], Any] = {})
- Return type:
Optional[QgsVectorLayerExporterTask]