QGIS API Documentation 3.99.0-Master (21b3aa880ba)
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
29
30#define SIP_NO_FILE
31
42class GUI_EXPORT QgsDbImportVectorLayerDialog : public QDialog, private Ui::QgsDbImportVectorLayerDialog, public QgsExpressionContextGenerator
43{
44 Q_OBJECT
45
46 public:
47
55
59 void setDestinationSchema( const QString &schema );
60
64 void setSourceUri( const QgsMimeDataUtils::Uri &uri );
65
69 QString schema() const;
70
74 QString tableName() const;
75
79 QString tableComment() const;
80
84 void setMapCanvas( QgsMapCanvas *canvas );
85
89 std::unique_ptr<QgsVectorLayerExporterTask> createExporterTask( const QVariantMap &extraProviderOptions = QVariantMap() );
90
92
93 private slots:
94 void sourceLayerComboChanged();
95 void doImport();
96 void setSourceLayer( QgsVectorLayer *layer );
97 void loadFieldsFromLayer();
98 void addField();
99
100 private:
101 QgsDatabaseSchemaComboBox *mSchemaCombo = nullptr;
102
103 std::unique_ptr< QgsVectorLayer > mOwnedSource;
104 QPointer< QgsVectorLayer > mSourceLayer;
105
106 int mBlockSourceLayerChanges = 0;
107
108 std::unique_ptr< QgsAbstractDatabaseProviderConnection > mConnection;
109};
110
111#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.
std::unique_ptr< QgsVectorLayerExporterTask > createExporterTask(const QVariantMap &extraProviderOptions=QVariantMap())
Creates a new exporter task to match the settings defined in the dialog.
void setMapCanvas(QgsMapCanvas *canvas)
Sets a map canvas to associate with the dialog.
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:36