QGIS API Documentation 4.3.0-Master (0cef2469b72)
Loading...
Searching...
No Matches
qgsdbimportvectorlayerdialog.h
Go to the documentation of this file.
1/***************************************************************************
2 qgsdbimportvectorlayerdialog.h
3 --------------------------------------
4 Date : March 2025
5 Copyright : (C) 2025 by Nyall Dawson
6 Email : nyall dot dawson at gmail dot com
7 ***************************************************************************
8 * *
9 * This program is free software; you can redistribute it and/or modify *
10 * it under the terms of the GNU General Public License as published by *
11 * the Free Software Foundation; either version 2 of the License, or *
12 * (at your option) any later version. *
13 * *
14 ***************************************************************************/
15
16#ifndef QGSDBIMPORTVECTORLAYERDIALOG_H
17#define QGSDBIMPORTVECTORLAYERDIALOG_H
18
19#include "ui_qgsdbimportvectorlayerdialog.h"
20
21#include "qgis.h"
22#include "qgis_gui.h"
24#include "qgsmimedatautils.h"
25
26#define SIP_NO_FILE
27
31class QgsVectorLayer;
32
33
44class GUI_EXPORT QgsDbImportVectorLayerDialog : public QDialog, private Ui::QgsDbImportVectorLayerDialog, public QgsExpressionContextGenerator
45{
46 Q_OBJECT
47
48 public:
56
60 void setDestinationSchema( const QString &schema );
61
65 void setSourceUri( const QgsMimeDataUtils::Uri &uri );
66
70 QString schema() const;
71
75 QString tableName() const;
76
80 QString tableComment() const;
81
85 bool saveStyleToDatabase() const;
86
91
95 QString geometryColumn() const;
96
100 void setMapCanvas( QgsMapCanvas *canvas );
101
105 std::unique_ptr<QgsVectorLayerExporterTask> createExporterTask( const QVariantMap &extraProviderOptions = QVariantMap() );
106
108
109 private slots:
110 void sourceLayerComboChanged();
111 void doImport();
112 void setSourceLayer( QgsVectorLayer *layer );
113 void loadFieldsFromLayer();
114 void addField();
115
116 private:
117 QgsDatabaseSchemaComboBox *mSchemaCombo = nullptr;
118
119 std::unique_ptr< QgsVectorLayer > mOwnedSource;
120 QPointer< QgsVectorLayer > mSourceLayer;
121
122 int mBlockSourceLayerChanges = 0;
123
124 std::unique_ptr< QgsAbstractDatabaseProviderConnection > mConnection;
125};
126
127#endif // QGSDBIMPORTVECTORLAYERDIALOG_H
Provides common functionality for database based connections.
A combo box which displays the list of schemas for a specific database connection.
void setDestinationSchema(const QString &schema)
Sets the destination schema for the new table.
QgsVectorLayer * sourceLayer() const
Returns the source layer, or nullptr if no source layer is set.
std::unique_ptr< QgsVectorLayerExporterTask > createExporterTask(const QVariantMap &extraProviderOptions=QVariantMap())
Creates a new exporter task to match the settings defined in the dialog.
bool saveStyleToDatabase() const
Returns true if the style should be saved to the database after import.
void setMapCanvas(QgsMapCanvas *canvas)
Sets a map canvas to associate with the dialog.
QString geometryColumn() const
Returns the geometry column name for the destination table.
void setSourceUri(const QgsMimeDataUtils::Uri &uri)
Sets the source table uri.
QString schema() const
Returns the destination schema.
QString tableName() const
Returns the destination table name.
QString tableComment() const
Returns the optional comment to use for the new table.
QgsDbImportVectorLayerDialog(QgsAbstractDatabaseProviderConnection *connection, QWidget *parent=nullptr)
Constructor for QgsDbImportVectorLayerDialog.
Abstract interface for generating an expression context.
virtual QgsExpressionContext createExpressionContext() const =0
This method needs to be reimplemented in all classes which implement this interface and return an exp...
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
Map canvas is a class for displaying all GIS data types on a canvas.
QgsTask task which performs a QgsVectorLayerExporter layer export operation as a background task.
Represents a vector layer which manages a vector based dataset.
#define SIP_TRANSFER
Definition qgis_sip.h:35