QGIS API Documentation 3.39.0-Master (bca3cdb6021)
Loading...
Searching...
No Matches
qgsvectorfilewritertask.h
Go to the documentation of this file.
1/***************************************************************************
2 qgsvectorfilewritertask.h
3 -------------------------
4 begin : Feb 2017
5 copyright : (C) 2017 by Nyall Dawson
6 email : nyall dot dawson at gmail dot com
7 ***************************************************************************/
8
9/***************************************************************************
10 * *
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
15 * *
16 ***************************************************************************/
17
18#ifndef QGSVECTORFILEWRITERTASK_H
19#define QGSVECTORFILEWRITERTASK_H
20
21#include "qgis_core.h"
22#include "qgsvectorfilewriter.h"
23#include "qgstaskmanager.h"
24
34class CORE_EXPORT QgsVectorFileWriterTask : public QgsTask
35{
36 Q_OBJECT
37
38 public:
39
47 const QString &fileName,
50
51 void cancel() override;
52
53 signals:
54
60 void writeComplete( const QString &newFilename );
61
67 void completed( const QString &newFilename, const QString &newLayer ) SIP_SKIP;
68
73 void errorOccurred( int error, const QString &errorMessage );
74
75 protected:
76
77 bool run() override;
78 void finished( bool result ) override;
79
80 private:
81
82 QString mDestFileName;
83
84 std::unique_ptr< QgsFeedback > mOwnedFeedback;
87
88 QString mNewFilename;
89 QString mNewLayer;
90 QString mErrorMessage;
91
93 QgsVectorFileWriter::PreparedWriterDetails mWriterDetails;
94 std::unique_ptr< QgsVectorFileWriter::FieldValueConverter > mFieldValueConverter;
95
96 QgsCoordinateTransformContext mTransformContext;
97};
98
99#endif
Contains information about the context in which a coordinate transform is executed.
QFlags< SinkFlag > SinkFlags
Abstract base class for long running background tasks.
virtual void finished(bool result)
If the task is managed by a QgsTaskManager, this will be called after the task has finished (whether ...
virtual bool run()=0
Performs the task's operation.
virtual void cancel()
Notifies the task that it should terminate.
QgsTask task which performs a QgsVectorFileWriter layer saving operation as a background task.
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 completed(const QString &newFilename, const QString &newLayer)
Emitted when writing the layer is successfully completed.
void writeComplete(const QString &newFilename)
Emitted when writing the layer is successfully completed.
Options to pass to writeAsVectorFormat()
Represents a vector layer which manages a vector based data sets.
#define SIP_SKIP
Definition qgis_sip.h:126