23 , mDestFileName( fileName )
36 mOptions.
feedback = mOwnedFeedback.get();
39 mError = QgsVectorFileWriter::prepareWriteAsVectorFormat( layer, mOptions, mWriterDetails );
57 mWriterDetails, mDestFileName, mOptions, &mNewFilename, &mErrorMessage, &mNewLayer );
66 emit
completed( mNewFilename, mNewLayer );
QgsVectorFileWriterTask(QgsVectorLayer *layer, const QString &fileName, const QgsVectorFileWriter::SaveVectorOptions &options)
Constructor for QgsVectorFileWriterTask.
void setProgress(double progress)
Sets the task's current progress.
void cancel() override
Notifies the task that it should terminate.
void cancel()
Tells the internal routines that the current operation should be canceled. This should be run by the ...
void completed(const QString &newFilename, const QString &newLayer)
Emitted when writing the layer is successfully completed.
Base class for feedback objects to be used for cancellation of something running in a worker thread...
Options to pass to writeAsVectorFormat()
virtual QgsVectorFileWriter::FieldValueConverter * clone() const
Creates a clone of the FieldValueConverter.
void errorOccurred(int error, const QString &errorMessage)
Emitted when an error occurs which prevented the file being written (or if the task is canceled)...
void progressChanged(double progress)
Emitted when the feedback object reports a progress change.
void writeComplete(const QString &newFilename)
Emitted when writing the layer is successfully completed.
bool run() override
Performs the task's operation.
Abstract base class for long running background tasks.
static QgsVectorFileWriter::WriterError writeAsVectorFormat(QgsVectorLayer *layer, const QString &fileName, const QString &fileEncoding, const QgsCoordinateReferenceSystem &destCRS=QgsCoordinateReferenceSystem(), const QString &driverName="GPKG", bool onlySelected=false, QString *errorMessage=nullptr, const QStringList &datasourceOptions=QStringList(), const QStringList &layerOptions=QStringList(), bool skipAttributeCreation=false, QString *newFilename=nullptr, QgsVectorFileWriter::SymbologyExport symbologyExport=QgsVectorFileWriter::NoSymbology, double symbologyScale=1.0, const QgsRectangle *filterExtent=nullptr, QgsWkbTypes::Type overrideGeometryType=QgsWkbTypes::Unknown, bool forceMulti=false, bool includeZ=false, const QgsAttributeList &attributes=QgsAttributeList(), QgsVectorFileWriter::FieldValueConverter *fieldValueConverter=nullptr, QString *newLayer=nullptr)
Write contents of vector layer to an (OGR supported) vector format.
virtual void cancel()
Notifies the task that it should terminate.
void finished(bool result) override
If the task is managed by a QgsTaskManager, this will be called after the task has finished (whether ...
QgsVectorFileWriter::FieldValueConverter * fieldValueConverter
Field value converter.
QgsFeedback * feedback
Optional feedback object allowing cancellation of layer save.
Represents a vector layer which manages a vector based data sets.