QGIS API Documentation  3.6.0-Noosa (5873452)
qgsnewgeopackagelayerdialog.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsnewgeopackagelayerdialog.h
3  -------------------
4  begin : April 2016
5  copyright : (C) 2016 by Even Rouault
6  email : even.rouault at spatialys.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 #ifndef QGSNEWGEOPACKAGELAYERDIALOG_H
18 #define QGSNEWGEOPACKAGELAYERDIALOG_H
19 
20 #include "ui_qgsnewgeopackagelayerdialogbase.h"
21 #include "qgsguiutils.h"
22 
23 #include "qgis_sip.h"
24 #include "qgis_gui.h"
25 
29 class GUI_EXPORT QgsNewGeoPackageLayerDialog: public QDialog, private Ui::QgsNewGeoPackageLayerDialogBase
30 {
31  Q_OBJECT
32 
33  public:
34 
37  {
41  };
42 
44  QgsNewGeoPackageLayerDialog( QWidget *parent SIP_TRANSFERTHIS = nullptr, Qt::WindowFlags fl = QgsGuiUtils::ModalDialogFlags );
45 
50  void setCrs( const QgsCoordinateReferenceSystem &crs );
51 
56  QString databasePath() const { return mDatabase->filePath(); }
57 
62  void setDatabasePath( const QString &path ) { mDatabase->setFilePath( path ); }
63 
68  void lockDatabasePath();
69 
77  void setOverwriteBehavior( OverwriteBehavior behavior );
78 
85  void setAddToProject( bool addToProject );
86 
87  private slots:
88  void mAddAttributeButton_clicked();
89  void mRemoveAttributeButton_clicked();
90  void mFieldTypeBox_currentIndexChanged( int index );
91  void mGeometryTypeBox_currentIndexChanged( int index );
92  void mTableNameEdit_textChanged( const QString &text );
93  void mTableNameEdit_textEdited( const QString &text );
94  void mLayerIdentifierEdit_textEdited( const QString &text );
95  void fieldNameChanged( const QString & );
96  void selectionChanged();
97  void checkOk();
98 
99  void showHelp();
100  void buttonBox_accepted();
101  void buttonBox_rejected();
102 
103  private:
104  bool apply();
105 
106  QPushButton *mOkButton = nullptr;
107  QString mCrsId;
108  bool mTableNameEdited = false;
109  bool mLayerIdentifierEdited = false;
110  OverwriteBehavior mBehavior = Prompt;
111  bool mAddToProject = true;
112 };
113 
114 #endif // QGSNEWVECTORLAYERDIALOG_H
Dialog to set up parameters to create a new GeoPackage layer, and on accept() to create it and add it...
#define SIP_TRANSFERTHIS
Definition: qgis_sip.h:46
QString databasePath() const
Returns the database path.
Keep existing contents and add new layer.
const QgsCoordinateReferenceSystem & crs
OverwriteBehavior
Behavior to use when an existing geopackage already exists.
void setDatabasePath(const QString &path)
Sets the initial database path.
This class represents a coordinate reference system (CRS).