QGIS API Documentation 3.43.0-Master (b60ef06885e)
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 "qgsproviderregistry.h"
26#include "qgsguiutils.h"
27#include <QDialog>
28#include <QDialogButtonBox>
29
30class QgsMapCanvas;
31class QgsBrowserModel;
32
33
46class GUI_EXPORT QgsAbstractDataSourceWidget : public QDialog
47{
48 Q_OBJECT
49
50 public:
57 virtual void setBrowserModel( QgsBrowserModel *model );
58
64 virtual QgsMapCanvas *mapCanvas() { return mMapCanvas; }
65
70 virtual void setMapCanvas( QgsMapCanvas *mapCanvas ) { mMapCanvas = mapCanvas; }
71
72 public slots:
73
78 virtual void refresh() {}
79
85 virtual void addButtonClicked();
86
96 virtual void reset();
97
106 virtual bool configureFromUri( const QString &uri );
107
108 signals:
109
115
117 void addDatabaseLayers( const QStringList &paths, const QString &providerKey );
118
124 Q_DECL_DEPRECATED void addRasterLayer( const QString &rasterLayerPath, const QString &baseName, const QString &providerKey ) SIP_DEPRECATED;
125
131 void addRasterLayers( const QStringList &layersList );
132
141 Q_DECL_DEPRECATED void addVectorLayer( const QString &uri, const QString &layerName, const QString &providerKey = QString() ) SIP_DEPRECATED;
142
148 Q_DECL_DEPRECATED void addMeshLayer( const QString &url, const QString &baseName, const QString &providerKey ) SIP_DEPRECATED;
149
155 Q_DECL_DEPRECATED void addVectorTileLayer( const QString &url, const QString &baseName ) SIP_DEPRECATED;
156
162 Q_DECL_DEPRECATED void addPointCloudLayer( const QString &url, const QString &baseName, const QString &providerKey ) SIP_DEPRECATED;
163
174 void addLayer( Qgis::LayerType type, const QString &url, const QString &baseName, const QString &providerKey );
175
182 void addVectorLayers( const QStringList &layerList, const QString &encoding, const QString &dataSourceType );
183
191 void replaceVectorLayer( const QString &oldId, const QString &source, const QString &name, const QString &provider );
192
198 Q_DECL_DEPRECATED void progress( int, int ) SIP_DEPRECATED;
199
201 void progressMessage( QString message );
202
204 void enableButtons( bool enable );
205
210 void pushMessage( const QString &title, const QString &message, const Qgis::MessageLevel level = Qgis::MessageLevel::Info );
211
212 protected:
214 QgsAbstractDataSourceWidget( QWidget *parent SIP_TRANSFERTHIS = nullptr, Qt::WindowFlags fl = QgsGuiUtils::ModalDialogFlags, QgsProviderRegistry::WidgetMode widgetMode = QgsProviderRegistry::WidgetMode::Standalone );
215
217 QgsProviderRegistry::WidgetMode widgetMode() const;
218
224 QgsBrowserModel *browserModel();
225
227 void setupButtons( QDialogButtonBox *buttonBox );
228
230 QPushButton *addButton() const { return mAddButton; }
231
232 private:
233 QPushButton *mAddButton = nullptr;
235 QgsBrowserModel *mBrowserModel = nullptr;
236 QgsMapCanvas *mMapCanvas = nullptr;
237};
238
239#endif // QGSABSTRACTDATASOURCEWIDGET_H
Provides global constants and enumerations for use throughout the application.
Definition qgis.h:54
Abstract base class for Data Source widgets to create connections and add layers.
virtual QgsMapCanvas * mapCanvas()
Returns the dialog map canvas.
Q_DECL_DEPRECATED void addRasterLayer(const QString &rasterLayerPath, const QString &baseName, const QString &providerKey)
Emitted when a raster layer has been selected for addition.
virtual void setMapCanvas(QgsMapCanvas *mapCanvas)
Sets the dialog map canvas.
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.
virtual void refresh()
Triggered when the provider's connections need to be refreshed The default implementation does nothin...
void addDatabaseLayers(const QStringList &paths, const QString &providerKey)
Emitted when a DB layer has been selected for addition.
Q_DECL_DEPRECATED void addVectorLayer(const QString &uri, const QString &layerName, const QString &providerKey=QString())
Emitted when a vector 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.
A registry / canonical manager of data providers.
WidgetMode
Different ways a source select dialog can be used.
The QgsGuiUtils namespace contains constants and helper functions used throughout the QGIS GUI.
#define SIP_DEPRECATED
Definition qgis_sip.h:106
#define SIP_TRANSFERTHIS
Definition qgis_sip.h:53