QGIS API Documentation  3.4.15-Madeira (e83d02e274)
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.h"
24 #include "qgis_gui.h"
25 
26 #include "qgsproviderregistry.h"
27 #include "qgsguiutils.h"
28 #include <QDialog>
29 #include <QDialogButtonBox>
30 
31 class QgsMapCanvas;
32 
41 class GUI_EXPORT QgsAbstractDataSourceWidget : public QDialog
42 {
43  Q_OBJECT
44 
45  public:
46 
51  void setMapCanvas( const QgsMapCanvas *mapCanvas );
52 
53 
54  public slots:
55 
60  virtual void refresh() {}
61 
67  virtual void addButtonClicked() { }
68 
69 
70  signals:
71 
76  void connectionsChanged();
77 
79  void addDatabaseLayers( const QStringList &paths, const QString &providerKey );
80 
82  void addRasterLayer( const QString &rasterLayerPath, const QString &baseName, const QString &providerKey );
83 
90  void addVectorLayer( const QString &uri, const QString &layerName, const QString &providerKey = QString() );
91 
96  void addMeshLayer( const QString &url, const QString &baseName, const QString &providerKey );
97 
104  void addVectorLayers( const QStringList &layerList, const QString &encoding, const QString &dataSourceType );
105 
113  void replaceVectorLayer( const QString &oldId, const QString &source, const QString &name, const QString &provider );
114 
120  Q_DECL_DEPRECATED void progress( int, int ) SIP_DEPRECATED;
121 
123  void progressMessage( QString message );
124 
126  void enableButtons( bool enable );
127 
128 
129  protected:
130 
132  QgsAbstractDataSourceWidget( QWidget *parent SIP_TRANSFERTHIS = nullptr, Qt::WindowFlags fl = QgsGuiUtils::ModalDialogFlags, QgsProviderRegistry::WidgetMode widgetMode = QgsProviderRegistry::WidgetMode::None );
133 
135  QgsProviderRegistry::WidgetMode widgetMode() const;
136 
138  const QgsMapCanvas *mapCanvas() const;
139 
141  void setupButtons( QDialogButtonBox *buttonBox );
142 
144  QPushButton *addButton( ) const { return mAddButton; }
145 
146  private:
147  QPushButton *mAddButton = nullptr;
149  QgsMapCanvas const *mMapCanvas = nullptr;
150 
151 };
152 
153 #endif // QGSABSTRACTDATASOURCEWIDGET_H
WidgetMode
Different ways a source select dialog can be used (embedded is for the data source manager dialog) ...
#define SIP_TRANSFERTHIS
Definition: qgis_sip.h:46
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:74
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:99
virtual void addButtonClicked()
Triggered when the add button is clicked, the add layer signal is emitted Concrete classes should imp...