QGIS API Documentation  3.13.0-Master (740be229cb)
qgsabstractdatasourcewidget.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsabstractdatasourcewidget.h - base class for source selector widgets
3  -------------------
4  begin : 10 July 2017
5  original : (C) 2017 by Alessandro Pasotti
6  email : apasotti at boundlessgeo dot com
7 
8  ***************************************************************************/
9 
10 /***************************************************************************
11  * *
12  * This program is free software; you can redistribute it and/or modify *
13  * it under the terms of the GNU General Public License as published by *
14  * the Free Software Foundation; either version 2 of the License, or *
15  * (at your option) any later version. *
16  * *
17  ***************************************************************************/
18 
19 #ifndef QGSABSTRACTDATASOURCEWIDGET_H
20 #define QGSABSTRACTDATASOURCEWIDGET_H
21 
22 #include "qgis_sip.h"
23 #include "qgis_gui.h"
24 
25 #include "qgsproviderguimetadata.h"
26 #include "qgsproviderregistry.h"
27 #include "qgsguiutils.h"
28 #include <QDialog>
29 #include <QDialogButtonBox>
30 
31 class QgsMapCanvas;
32 
33 
42 class GUI_EXPORT QgsAbstractDataSourceWidget : public QDialog
43 {
44  Q_OBJECT
45 
46  public:
47 
52  void setMapCanvas( const QgsMapCanvas *mapCanvas );
53 
54 
55  public slots:
56 
61  virtual void refresh() {}
62 
68  virtual void addButtonClicked();
69 
79  virtual void reset();
80 
81  signals:
82 
87  void connectionsChanged();
88 
90  void addDatabaseLayers( const QStringList &paths, const QString &providerKey );
91 
93  void addRasterLayer( const QString &rasterLayerPath, const QString &baseName, const QString &providerKey );
94 
101  void addVectorLayer( const QString &uri, const QString &layerName, const QString &providerKey = QString() );
102 
107  void addMeshLayer( const QString &url, const QString &baseName, const QString &providerKey );
108 
115  void addVectorLayers( const QStringList &layerList, const QString &encoding, const QString &dataSourceType );
116 
124  void replaceVectorLayer( const QString &oldId, const QString &source, const QString &name, const QString &provider );
125 
131  Q_DECL_DEPRECATED void progress( int, int ) SIP_DEPRECATED;
132 
134  void progressMessage( QString message );
135 
137  void enableButtons( bool enable );
138 
139 
140  protected:
141 
143  QgsAbstractDataSourceWidget( QWidget *parent SIP_TRANSFERTHIS = nullptr, Qt::WindowFlags fl = QgsGuiUtils::ModalDialogFlags, QgsProviderRegistry::WidgetMode widgetMode = QgsProviderRegistry::WidgetMode::None );
144 
146  QgsProviderRegistry::WidgetMode widgetMode() const;
147 
149  const QgsMapCanvas *mapCanvas() const;
150 
152  void setupButtons( QDialogButtonBox *buttonBox );
153 
155  QPushButton *addButton( ) const { return mAddButton; }
156 
157  private:
158  QPushButton *mAddButton = nullptr;
160  QgsMapCanvas const *mMapCanvas = nullptr;
161 
162 };
163 
164 #endif // QGSABSTRACTDATASOURCEWIDGET_H
WidgetMode
Different ways a source select dialog can be used.
#define SIP_TRANSFERTHIS
Definition: qgis_sip.h:53
Abstract base Data Source Widget to create connections and add layers This class provides common func...
Map canvas is a class for displaying all GIS data types on a canvas.
Definition: qgsmapcanvas.h:78
virtual void refresh()
Triggered when the provider&#39;s connections need to be refreshed The default implementation does nothin...
QPushButton * addButton() const
Returns the add Button.
#define SIP_DEPRECATED
Definition: qgis_sip.h:106