QGIS API Documentation  3.24.2-Tisler (13c1a02865)
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 class QgsBrowserModel;
33 
34 
43 class GUI_EXPORT QgsAbstractDataSourceWidget : public QDialog
44 {
45  Q_OBJECT
46 
47  public:
48 
53  void setMapCanvas( const QgsMapCanvas *mapCanvas );
54 
61  void setBrowserModel( QgsBrowserModel *model );
62 
63  public slots:
64 
69  virtual void refresh() {}
70 
76  virtual void addButtonClicked();
77 
87  virtual void reset();
88 
89  signals:
90 
96 
98  void addDatabaseLayers( const QStringList &paths, const QString &providerKey );
99 
101  void addRasterLayer( const QString &rasterLayerPath, const QString &baseName, const QString &providerKey );
102 
108  void addRasterLayers( const QStringList &layersList );
109 
116  void addVectorLayer( const QString &uri, const QString &layerName, const QString &providerKey = QString() );
117 
122  void addMeshLayer( const QString &url, const QString &baseName, const QString &providerKey );
123 
128  void addVectorTileLayer( const QString &url, const QString &baseName );
129 
134  void addPointCloudLayer( const QString &url, const QString &baseName, const QString &providerKey );
135 
142  void addVectorLayers( const QStringList &layerList, const QString &encoding, const QString &dataSourceType );
143 
151  void replaceVectorLayer( const QString &oldId, const QString &source, const QString &name, const QString &provider );
152 
158  Q_DECL_DEPRECATED void progress( int, int ) SIP_DEPRECATED;
159 
161  void progressMessage( QString message );
162 
164  void enableButtons( bool enable );
165 
170  void pushMessage( const QString &title, const QString &message, const Qgis::MessageLevel level = Qgis::MessageLevel::Info );
171 
172 
173  protected:
174 
176  QgsAbstractDataSourceWidget( QWidget *parent SIP_TRANSFERTHIS = nullptr, Qt::WindowFlags fl = QgsGuiUtils::ModalDialogFlags, QgsProviderRegistry::WidgetMode widgetMode = QgsProviderRegistry::WidgetMode::None );
177 
179  QgsProviderRegistry::WidgetMode widgetMode() const;
180 
182  const QgsMapCanvas *mapCanvas() const;
183 
189  QgsBrowserModel *browserModel();
190 
192  void setupButtons( QDialogButtonBox *buttonBox );
193 
195  QPushButton *addButton( ) const { return mAddButton; }
196 
197  private:
198  QPushButton *mAddButton = nullptr;
200  QgsMapCanvas const *mMapCanvas = nullptr;
201  QgsBrowserModel *mBrowserModel = nullptr;
202 
203 };
204 
205 #endif // QGSABSTRACTDATASOURCEWIDGET_H
MessageLevel
Level for messages This will be used both for message log and message bar in application.
Definition: qgis.h:107
Abstract base Data Source Widget to create connections and add layers This class provides common func...
void addPointCloudLayer(const QString &url, const QString &baseName, const QString &providerKey)
Emitted when a point cloud layer has been selected for addition.
void enableButtons(bool enable)
Emitted when the ok/add buttons should be enabled/disabled.
void pushMessage(const QString &title, const QString &message, const Qgis::MessageLevel level=Qgis::MessageLevel::Info)
Emitted when a message with title and level must be shown to the user using the parent visible messag...
Q_DECL_DEPRECATED void progress(int, int)
Emitted when a progress dialog is shown by the provider dialog.
QPushButton * addButton() const
Returns the add Button.
void replaceVectorLayer(const QString &oldId, const QString &source, const QString &name, const QString &provider)
Emitted when a layer needs to be replaced.
void connectionsChanged()
Emitted when the provider's connections have changed This signal is normally forwarded the app and us...
void addRasterLayers(const QStringList &layersList)
Emitted when one or more GDAL supported layers are selected for addition.
void addMeshLayer(const QString &url, const QString &baseName, const QString &providerKey)
Emitted when a mesh layer has been selected for addition.
void addRasterLayer(const QString &rasterLayerPath, const QString &baseName, const QString &providerKey)
Emitted when a raster layer has been selected for addition.
virtual void refresh()
Triggered when the provider's connections need to be refreshed The default implementation does nothin...
void progressMessage(QString message)
Emitted when a progress dialog is shown by the provider dialog.
void addVectorLayers(const QStringList &layerList, const QString &encoding, const QString &dataSourceType)
Emitted when one or more OGR supported layers are selected for addition.
void addVectorLayer(const QString &uri, const QString &layerName, const QString &providerKey=QString())
Emitted when a vector layer has been selected for addition.
void addDatabaseLayers(const QStringList &paths, const QString &providerKey)
Emitted when a DB layer has been selected for addition.
void addVectorTileLayer(const QString &url, const QString &baseName)
Emitted when a vector tile layer has been selected for addition.
A model for showing available data sources and other items in a structured tree.
Map canvas is a class for displaying all GIS data types on a canvas.
Definition: qgsmapcanvas.h:90
WidgetMode
Different ways a source select dialog can be used.
#define SIP_DEPRECATED
Definition: qgis_sip.h:106
#define SIP_TRANSFERTHIS
Definition: qgis_sip.h:53