QGIS API Documentation 3.40.0-Bratislava (b56115d8743)
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:
50
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:
213
215 QgsAbstractDataSourceWidget( QWidget *parent SIP_TRANSFERTHIS = nullptr, Qt::WindowFlags fl = QgsGuiUtils::ModalDialogFlags, QgsProviderRegistry::WidgetMode widgetMode = QgsProviderRegistry::WidgetMode::Standalone );
216
218 QgsProviderRegistry::WidgetMode widgetMode() const;
219
225 QgsBrowserModel *browserModel();
226
228 void setupButtons( QDialogButtonBox *buttonBox );
229
231 QPushButton *addButton( ) const { return mAddButton; }
232
233 private:
234 QPushButton *mAddButton = nullptr;
236 QgsBrowserModel *mBrowserModel = nullptr;
237 QgsMapCanvas *mMapCanvas = nullptr;
238
239};
240
241#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