QGIS API Documentation 3.41.0-Master (cea29feecf2)
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
45class GUI_EXPORT QgsAbstractDataSourceWidget : public QDialog
46{
47 Q_OBJECT
48
49 public:
56 virtual void setBrowserModel( QgsBrowserModel *model );
57
63 virtual QgsMapCanvas *mapCanvas() { return mMapCanvas; }
64
69 virtual void setMapCanvas( QgsMapCanvas *mapCanvas ) { mMapCanvas = mapCanvas; }
70
71 public slots:
72
77 virtual void refresh() {}
78
84 virtual void addButtonClicked();
85
95 virtual void reset();
96
105 virtual bool configureFromUri( const QString &uri );
106
107 signals:
108
114
116 void addDatabaseLayers( const QStringList &paths, const QString &providerKey );
117
123 Q_DECL_DEPRECATED void addRasterLayer( const QString &rasterLayerPath, const QString &baseName, const QString &providerKey ) SIP_DEPRECATED;
124
130 void addRasterLayers( const QStringList &layersList );
131
140 Q_DECL_DEPRECATED void addVectorLayer( const QString &uri, const QString &layerName, const QString &providerKey = QString() ) SIP_DEPRECATED;
141
147 Q_DECL_DEPRECATED void addMeshLayer( const QString &url, const QString &baseName, const QString &providerKey ) SIP_DEPRECATED;
148
154 Q_DECL_DEPRECATED void addVectorTileLayer( const QString &url, const QString &baseName ) SIP_DEPRECATED;
155
161 Q_DECL_DEPRECATED void addPointCloudLayer( const QString &url, const QString &baseName, const QString &providerKey ) SIP_DEPRECATED;
162
173 void addLayer( Qgis::LayerType type, const QString &url, const QString &baseName, const QString &providerKey );
174
181 void addVectorLayers( const QStringList &layerList, const QString &encoding, const QString &dataSourceType );
182
190 void replaceVectorLayer( const QString &oldId, const QString &source, const QString &name, const QString &provider );
191
197 Q_DECL_DEPRECATED void progress( int, int ) SIP_DEPRECATED;
198
200 void progressMessage( QString message );
201
203 void enableButtons( bool enable );
204
209 void pushMessage( const QString &title, const QString &message, const Qgis::MessageLevel level = Qgis::MessageLevel::Info );
210
211 protected:
213 QgsAbstractDataSourceWidget( QWidget *parent SIP_TRANSFERTHIS = nullptr, Qt::WindowFlags fl = QgsGuiUtils::ModalDialogFlags, QgsProviderRegistry::WidgetMode widgetMode = QgsProviderRegistry::WidgetMode::Standalone );
214
216 QgsProviderRegistry::WidgetMode widgetMode() const;
217
223 QgsBrowserModel *browserModel();
224
226 void setupButtons( QDialogButtonBox *buttonBox );
227
229 QPushButton *addButton() const { return mAddButton; }
230
231 private:
232 QPushButton *mAddButton = nullptr;
234 QgsBrowserModel *mBrowserModel = nullptr;
235 QgsMapCanvas *mMapCanvas = nullptr;
236};
237
238#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