QGIS API Documentation 3.28.0-Firenze (ed3ad0430f)
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
26#include "qgsproviderregistry.h"
27#include "qgsguiutils.h"
28#include <QDialog>
29#include <QDialogButtonBox>
30
31class QgsMapCanvas;
32class QgsBrowserModel;
33
34
47class GUI_EXPORT QgsAbstractDataSourceWidget : public QDialog
48{
49 Q_OBJECT
50
51 public:
52
59 virtual void setBrowserModel( QgsBrowserModel *model );
60
66 virtual QgsMapCanvas *mapCanvas() {return mMapCanvas; }
67
72 virtual void setMapCanvas( QgsMapCanvas *mapCanvas ) { mMapCanvas = mapCanvas; }
73
74 public slots:
75
80 virtual void refresh() {}
81
87 virtual void addButtonClicked();
88
98 virtual void reset();
99
100 signals:
101
107
109 void addDatabaseLayers( const QStringList &paths, const QString &providerKey );
110
112 void addRasterLayer( const QString &rasterLayerPath, const QString &baseName, const QString &providerKey );
113
119 void addRasterLayers( const QStringList &layersList );
120
127 void addVectorLayer( const QString &uri, const QString &layerName, const QString &providerKey = QString() );
128
133 void addMeshLayer( const QString &url, const QString &baseName, const QString &providerKey );
134
139 void addVectorTileLayer( const QString &url, const QString &baseName );
140
145 void addPointCloudLayer( const QString &url, const QString &baseName, const QString &providerKey );
146
153 void addVectorLayers( const QStringList &layerList, const QString &encoding, const QString &dataSourceType );
154
162 void replaceVectorLayer( const QString &oldId, const QString &source, const QString &name, const QString &provider );
163
169 Q_DECL_DEPRECATED void progress( int, int ) SIP_DEPRECATED;
170
172 void progressMessage( QString message );
173
175 void enableButtons( bool enable );
176
181 void pushMessage( const QString &title, const QString &message, const Qgis::MessageLevel level = Qgis::MessageLevel::Info );
182
183 protected:
184
186 QgsAbstractDataSourceWidget( QWidget *parent SIP_TRANSFERTHIS = nullptr, Qt::WindowFlags fl = QgsGuiUtils::ModalDialogFlags, QgsProviderRegistry::WidgetMode widgetMode = QgsProviderRegistry::WidgetMode::None );
187
189 QgsProviderRegistry::WidgetMode widgetMode() const;
190
196 QgsBrowserModel *browserModel();
197
199 void setupButtons( QDialogButtonBox *buttonBox );
200
202 QPushButton *addButton( ) const { return mAddButton; }
203
204 private:
205 QPushButton *mAddButton = nullptr;
207 QgsBrowserModel *mBrowserModel = nullptr;
208 QgsMapCanvas *mMapCanvas = nullptr;
209
210};
211
212#endif // QGSABSTRACTDATASOURCEWIDGET_H
MessageLevel
Level for messages This will be used both for message log and message bar in application.
Definition: qgis.h:115
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.
virtual QgsMapCanvas * mapCanvas()
Returns the dialog map canvas.
QPushButton * addButton() const
Returns the add Button.
virtual void setMapCanvas(QgsMapCanvas *mapCanvas)
Sets the dialog map canvas.
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