QGIS API Documentation 3.34.0-Prizren (ffbdd678812)
Loading...
Searching...
No Matches
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:
51
58 virtual void setBrowserModel( QgsBrowserModel *model );
59
65 virtual QgsMapCanvas *mapCanvas() {return mMapCanvas; }
66
71 virtual void setMapCanvas( QgsMapCanvas *mapCanvas ) { mMapCanvas = mapCanvas; }
72
73 public slots:
74
79 virtual void refresh() {}
80
86 virtual void addButtonClicked();
87
97 virtual void reset();
98
99 signals:
100
106
108 void addDatabaseLayers( const QStringList &paths, const QString &providerKey );
109
115 Q_DECL_DEPRECATED void addRasterLayer( const QString &rasterLayerPath, const QString &baseName, const QString &providerKey ) SIP_DEPRECATED;
116
122 void addRasterLayers( const QStringList &layersList );
123
132 Q_DECL_DEPRECATED void addVectorLayer( const QString &uri, const QString &layerName, const QString &providerKey = QString() ) SIP_DEPRECATED;
133
139 Q_DECL_DEPRECATED void addMeshLayer( const QString &url, const QString &baseName, const QString &providerKey ) SIP_DEPRECATED;
140
146 Q_DECL_DEPRECATED void addVectorTileLayer( const QString &url, const QString &baseName ) SIP_DEPRECATED;
147
153 Q_DECL_DEPRECATED void addPointCloudLayer( const QString &url, const QString &baseName, const QString &providerKey ) SIP_DEPRECATED;
154
165 void addLayer( Qgis::LayerType type, const QString &url, const QString &baseName, const QString &providerKey );
166
173 void addVectorLayers( const QStringList &layerList, const QString &encoding, const QString &dataSourceType );
174
182 void replaceVectorLayer( const QString &oldId, const QString &source, const QString &name, const QString &provider );
183
189 Q_DECL_DEPRECATED void progress( int, int ) SIP_DEPRECATED;
190
192 void progressMessage( QString message );
193
195 void enableButtons( bool enable );
196
201 void pushMessage( const QString &title, const QString &message, const Qgis::MessageLevel level = Qgis::MessageLevel::Info );
202
203 protected:
204
206 QgsAbstractDataSourceWidget( QWidget *parent SIP_TRANSFERTHIS = nullptr, Qt::WindowFlags fl = QgsGuiUtils::ModalDialogFlags, QgsProviderRegistry::WidgetMode widgetMode = QgsProviderRegistry::WidgetMode::None );
207
209 QgsProviderRegistry::WidgetMode widgetMode() const;
210
216 QgsBrowserModel *browserModel();
217
219 void setupButtons( QDialogButtonBox *buttonBox );
220
222 QPushButton *addButton( ) const { return mAddButton; }
223
224 private:
225 QPushButton *mAddButton = nullptr;
227 QgsBrowserModel *mBrowserModel = nullptr;
228 QgsMapCanvas *mMapCanvas = nullptr;
229
230};
231
232#endif // QGSABSTRACTDATASOURCEWIDGET_H
The Qgis class provides global constants for use throughout the application.
Definition qgis.h:54
Abstract base Data Source Widget to create connections and add layers This class provides common func...
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