QGIS API Documentation  3.26.3-Buenos Aires (65e4edfdad)
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 
55  virtual void setBrowserModel( QgsBrowserModel *model );
56 
62  virtual QgsMapCanvas *mapCanvas() {return mMapCanvas; }
63 
68  virtual void setMapCanvas( QgsMapCanvas *mapCanvas ) { mMapCanvas = mapCanvas; }
69 
70  public slots:
71 
76  virtual void refresh() {}
77 
83  virtual void addButtonClicked();
84 
94  virtual void reset();
95 
96  signals:
97 
102  void connectionsChanged();
103 
105  void addDatabaseLayers( const QStringList &paths, const QString &providerKey );
106 
108  void addRasterLayer( const QString &rasterLayerPath, const QString &baseName, const QString &providerKey );
109 
115  void addRasterLayers( const QStringList &layersList );
116 
123  void addVectorLayer( const QString &uri, const QString &layerName, const QString &providerKey = QString() );
124 
129  void addMeshLayer( const QString &url, const QString &baseName, const QString &providerKey );
130 
135  void addVectorTileLayer( const QString &url, const QString &baseName );
136 
141  void addPointCloudLayer( const QString &url, const QString &baseName, const QString &providerKey );
142 
149  void addVectorLayers( const QStringList &layerList, const QString &encoding, const QString &dataSourceType );
150 
158  void replaceVectorLayer( const QString &oldId, const QString &source, const QString &name, const QString &provider );
159 
165  Q_DECL_DEPRECATED void progress( int, int ) SIP_DEPRECATED;
166 
168  void progressMessage( QString message );
169 
171  void enableButtons( bool enable );
172 
177  void pushMessage( const QString &title, const QString &message, const Qgis::MessageLevel level = Qgis::MessageLevel::Info );
178 
179  protected:
180 
182  QgsAbstractDataSourceWidget( QWidget *parent SIP_TRANSFERTHIS = nullptr, Qt::WindowFlags fl = QgsGuiUtils::ModalDialogFlags, QgsProviderRegistry::WidgetMode widgetMode = QgsProviderRegistry::WidgetMode::None );
183 
185  QgsProviderRegistry::WidgetMode widgetMode() const;
186 
192  QgsBrowserModel *browserModel();
193 
195  void setupButtons( QDialogButtonBox *buttonBox );
196 
198  QPushButton *addButton( ) const { return mAddButton; }
199 
200  private:
201  QPushButton *mAddButton = nullptr;
203  QgsBrowserModel *mBrowserModel = nullptr;
204  QgsMapCanvas *mMapCanvas = nullptr;
205 
206 };
207 
208 #endif // QGSABSTRACTDATASOURCEWIDGET_H
qgsproviderguimetadata.h
QgsAbstractDataSourceWidget
Abstract base Data Source Widget to create connections and add layers This class provides common func...
Definition: qgsabstractdatasourcewidget.h:43
QgsMapCanvas
Map canvas is a class for displaying all GIS data types on a canvas.
Definition: qgsmapcanvas.h:89
SIP_DEPRECATED
#define SIP_DEPRECATED
Definition: qgis_sip.h:106
QgsProviderRegistry::WidgetMode
WidgetMode
Different ways a source select dialog can be used.
Definition: qgsproviderregistry.h:70
qgsproviderregistry.h
QgsAbstractDataSourceWidget::mapCanvas
virtual QgsMapCanvas * mapCanvas()
Returns the dialog map canvas.
Definition: qgsabstractdatasourcewidget.h:62
qgis_sip.h
Qgis::MessageLevel
MessageLevel
Level for messages This will be used both for message log and message bar in application.
Definition: qgis.h:114
QgsAbstractDataSourceWidget::setMapCanvas
virtual void setMapCanvas(QgsMapCanvas *mapCanvas)
Sets the dialog map canvas.
Definition: qgsabstractdatasourcewidget.h:68
QgsAbstractDataSourceWidget::addButton
QPushButton * addButton() const
Returns the add Button.
Definition: qgsabstractdatasourcewidget.h:198
qgsguiutils.h
QgsAbstractDataSourceWidget::refresh
virtual void refresh()
Triggered when the provider's connections need to be refreshed The default implementation does nothin...
Definition: qgsabstractdatasourcewidget.h:76
SIP_TRANSFERTHIS
#define SIP_TRANSFERTHIS
Definition: qgis_sip.h:53
QgsBrowserModel
A model for showing available data sources and other items in a structured tree.
Definition: qgsbrowsermodel.h:52