QGIS API Documentation  3.14.0-Pi (9f7028fd23)
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 
113  void addVectorTileLayer( const QString &url, const QString &baseName );
114 
121  void addVectorLayers( const QStringList &layerList, const QString &encoding, const QString &dataSourceType );
122 
130  void replaceVectorLayer( const QString &oldId, const QString &source, const QString &name, const QString &provider );
131 
137  Q_DECL_DEPRECATED void progress( int, int ) SIP_DEPRECATED;
138 
140  void progressMessage( QString message );
141 
143  void enableButtons( bool enable );
144 
149  void pushMessage( const QString &title, const QString &message, const Qgis::MessageLevel level = Qgis::MessageLevel::Info );
150 
151 
152  protected:
153 
155  QgsAbstractDataSourceWidget( QWidget *parent SIP_TRANSFERTHIS = nullptr, Qt::WindowFlags fl = QgsGuiUtils::ModalDialogFlags, QgsProviderRegistry::WidgetMode widgetMode = QgsProviderRegistry::WidgetMode::None );
156 
158  QgsProviderRegistry::WidgetMode widgetMode() const;
159 
161  const QgsMapCanvas *mapCanvas() const;
162 
164  void setupButtons( QDialogButtonBox *buttonBox );
165 
167  QPushButton *addButton( ) const { return mAddButton; }
168 
169  private:
170  QPushButton *mAddButton = nullptr;
172  QgsMapCanvas const *mMapCanvas = nullptr;
173 
174 };
175 
176 #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:42
QgsMapCanvas
Definition: qgsmapcanvas.h:83
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:63
qgsproviderregistry.h
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:101
QgsAbstractDataSourceWidget::addButton
QPushButton * addButton() const
Returns the add Button.
Definition: qgsabstractdatasourcewidget.h:167
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:61
SIP_TRANSFERTHIS
#define SIP_TRANSFERTHIS
Definition: qgis_sip.h:53