QGIS API Documentation 3.37.0-Master (fdefdf9c27f)
Public Slots | Signals | Public Member Functions | Protected Member Functions | List of all members
QgsAbstractDataSourceWidget Class Reference

Abstract base Data Source Widget to create connections and add layers This class provides common functionality and the interface for all source select dialogs used by data providers to configure data sources and add layers. More...

#include <qgsabstractdatasourcewidget.h>

Inheritance diagram for QgsAbstractDataSourceWidget:
Inheritance graph
[legend]

Public Slots

virtual void addButtonClicked ()
 Triggered when the add button is clicked, the add layer signal is emitted Concrete classes should implement the right behavior depending on the layer being added. More...
 
virtual bool configureFromUri (const QString &uri)
 Configure the widget from a layer uri by selecting the layer path or connection options. More...
 
virtual void refresh ()
 Triggered when the provider's connections need to be refreshed The default implementation does nothing. More...
 
virtual void reset ()
 Called when this source select widget is being shown in a "new and clean" dialog. More...
 

Signals

void addDatabaseLayers (const QStringList &paths, const QString &providerKey)
 Emitted when a DB layer has been selected for addition. More...
 
void addLayer (Qgis::LayerType type, const QString &url, const QString &baseName, const QString &providerKey)
 Emitted when a layer has been selected for addition. More...
 
Q_DECL_DEPRECATED void addMeshLayer (const QString &url, const QString &baseName, const QString &providerKey)
 Emitted when a mesh layer has been selected for addition. More...
 
Q_DECL_DEPRECATED void addPointCloudLayer (const QString &url, const QString &baseName, const QString &providerKey)
 Emitted when a point cloud layer has been selected for addition. More...
 
Q_DECL_DEPRECATED void addRasterLayer (const QString &rasterLayerPath, const QString &baseName, const QString &providerKey)
 Emitted when a raster layer has been selected for addition. More...
 
void addRasterLayers (const QStringList &layersList)
 Emitted when one or more GDAL supported layers are selected for addition. More...
 
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. More...
 
void addVectorLayers (const QStringList &layerList, const QString &encoding, const QString &dataSourceType)
 Emitted when one or more OGR supported layers are selected for addition. More...
 
Q_DECL_DEPRECATED void addVectorTileLayer (const QString &url, const QString &baseName)
 Emitted when a vector tile layer has been selected for addition. More...
 
void connectionsChanged ()
 Emitted when the provider's connections have changed This signal is normally forwarded the app and used to refresh browser items. More...
 
void enableButtons (bool enable)
 Emitted when the ok/add buttons should be enabled/disabled. More...
 
Q_DECL_DEPRECATED void progress (int, int)
 Emitted when a progress dialog is shown by the provider dialog. More...
 
void progressMessage (QString message)
 Emitted when a progress dialog is shown by the provider dialog. More...
 
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 message bar. More...
 
void replaceVectorLayer (const QString &oldId, const QString &source, const QString &name, const QString &provider)
 Emitted when a layer needs to be replaced. More...
 

Public Member Functions

virtual QgsMapCanvasmapCanvas ()
 Returns the dialog map canvas. More...
 
virtual void setBrowserModel (QgsBrowserModel *model)
 Sets a browser model to use with the widget. More...
 
virtual void setMapCanvas (QgsMapCanvas *mapCanvas)
 Sets the dialog map canvas. More...
 

Protected Member Functions

 QgsAbstractDataSourceWidget (QWidget *parent=nullptr, Qt::WindowFlags fl=QgsGuiUtils::ModalDialogFlags, QgsProviderRegistry::WidgetMode widgetMode=QgsProviderRegistry::WidgetMode::None)
 Constructor. More...
 
QPushButton * addButton () const
 Returns the add Button. More...
 
QgsBrowserModelbrowserModel ()
 Returns the associated browser model (may be nullptr). More...
 
void setupButtons (QDialogButtonBox *buttonBox)
 Connect the ok and apply/add buttons to the slots. More...
 
QgsProviderRegistry::WidgetMode widgetMode () const
 Returns the widget mode. More...
 

Detailed Description

Abstract base Data Source Widget to create connections and add layers This class provides common functionality and the interface for all source select dialogs used by data providers to configure data sources and add layers.

The implementation is generic enough to handle other layer search and selection widgets.

Definition at line 45 of file qgsabstractdatasourcewidget.h.

Constructor & Destructor Documentation

◆ QgsAbstractDataSourceWidget()

QgsAbstractDataSourceWidget::QgsAbstractDataSourceWidget ( QWidget *  parent = nullptr,
Qt::WindowFlags  fl = QgsGuiUtils::ModalDialogFlags,
QgsProviderRegistry::WidgetMode  widgetMode = QgsProviderRegistry::WidgetMode::None 
)
protected

Constructor.

Definition at line 22 of file qgsabstractdatasourcewidget.cpp.

Member Function Documentation

◆ addButton()

QPushButton * QgsAbstractDataSourceWidget::addButton ( ) const
inlineprotected

Returns the add Button.

Definition at line 231 of file qgsabstractdatasourcewidget.h.

◆ addButtonClicked

void QgsAbstractDataSourceWidget::addButtonClicked ( )
virtualslot

Triggered when the add button is clicked, the add layer signal is emitted Concrete classes should implement the right behavior depending on the layer being added.

Definition at line 61 of file qgsabstractdatasourcewidget.cpp.

◆ addDatabaseLayers

void QgsAbstractDataSourceWidget::addDatabaseLayers ( const QStringList &  paths,
const QString &  providerKey 
)
signal

Emitted when a DB layer has been selected for addition.

◆ addLayer

void QgsAbstractDataSourceWidget::addLayer ( Qgis::LayerType  type,
const QString &  url,
const QString &  baseName,
const QString &  providerKey 
)
signal

Emitted when a layer has been selected for addition.

This is a generic method, intended for replacing the specific layer type signals implemented above.

Warning
For QGIS versions < 4.x, the specific layer type added signals must be emitted for vector, raster, mesh, vector tile and point cloud layers in addition to this signal.
Since
QGIS 3.34

◆ addMeshLayer

Q_DECL_DEPRECATED void QgsAbstractDataSourceWidget::addMeshLayer ( const QString &  url,
const QString &  baseName,
const QString &  providerKey 
)
signal

Emitted when a mesh layer has been selected for addition.

Deprecated:
use addLayer() instead.

◆ addPointCloudLayer

Q_DECL_DEPRECATED void QgsAbstractDataSourceWidget::addPointCloudLayer ( const QString &  url,
const QString &  baseName,
const QString &  providerKey 
)
signal

Emitted when a point cloud layer has been selected for addition.

Deprecated:
use addLayer() instead.

◆ addRasterLayer

Q_DECL_DEPRECATED void QgsAbstractDataSourceWidget::addRasterLayer ( const QString &  rasterLayerPath,
const QString &  baseName,
const QString &  providerKey 
)
signal

Emitted when a raster layer has been selected for addition.

Deprecated:
use addLayer() instead.

◆ addRasterLayers

void QgsAbstractDataSourceWidget::addRasterLayers ( const QStringList &  layersList)
signal

Emitted when one or more GDAL supported layers are selected for addition.

Parameters
layersListlist of layers protocol URIs
Since
QGIS 3.20

◆ addVectorLayer

Q_DECL_DEPRECATED void QgsAbstractDataSourceWidget::addVectorLayer ( const QString &  uri,
const QString &  layerName,
const QString &  providerKey = QString() 
)
signal

Emitted when a vector layer has been selected for addition.

If providerKey is not specified, the default provider key associated with the source will be used.

Deprecated:
use addLayer() instead.

◆ addVectorLayers

void QgsAbstractDataSourceWidget::addVectorLayers ( const QStringList &  layerList,
const QString &  encoding,
const QString &  dataSourceType 
)
signal

Emitted when one or more OGR supported layers are selected for addition.

Parameters
layerListlist of layers protocol URIs
encodingencoding
dataSourceTypestring (can be "file" or "database")

◆ addVectorTileLayer

Q_DECL_DEPRECATED void QgsAbstractDataSourceWidget::addVectorTileLayer ( const QString &  url,
const QString &  baseName 
)
signal

Emitted when a vector tile layer has been selected for addition.

Deprecated:
use addLayer() instead.

◆ browserModel()

QgsBrowserModel * QgsAbstractDataSourceWidget::browserModel ( )
protected

Returns the associated browser model (may be nullptr).

Since
QGIS 3.18

Definition at line 33 of file qgsabstractdatasourcewidget.cpp.

◆ configureFromUri

bool QgsAbstractDataSourceWidget::configureFromUri ( const QString &  uri)
virtualslot

Configure the widget from a layer uri by selecting the layer path or connection options.

The base implementation does nothing and returns false: providers with ConfigureSourceSelectFromUri capability must override to implement this functionality.

Returns
true on success.
Note
Not all data providers may be able to configure the widget from the provided uri, in that case this method returns false.
Since
QGIS 3.38

Definition at line 69 of file qgsabstractdatasourcewidget.cpp.

◆ connectionsChanged

void QgsAbstractDataSourceWidget::connectionsChanged ( )
signal

Emitted when the provider's connections have changed This signal is normally forwarded the app and used to refresh browser items.

◆ enableButtons

void QgsAbstractDataSourceWidget::enableButtons ( bool  enable)
signal

Emitted when the ok/add buttons should be enabled/disabled.

◆ mapCanvas()

virtual QgsMapCanvas * QgsAbstractDataSourceWidget::mapCanvas ( )
inlinevirtual

Returns the dialog map canvas.

See also
setMapCanvas()

Definition at line 64 of file qgsabstractdatasourcewidget.h.

◆ progress

Q_DECL_DEPRECATED void QgsAbstractDataSourceWidget::progress ( int  ,
int   
)
signal

Emitted when a progress dialog is shown by the provider dialog.

Deprecated:
Since QGIS 3.4 this signal is no longer used. Use QgsProxyProgressTask instead to show progress reports.

◆ progressMessage

void QgsAbstractDataSourceWidget::progressMessage ( QString  message)
signal

Emitted when a progress dialog is shown by the provider dialog.

◆ pushMessage

void QgsAbstractDataSourceWidget::pushMessage ( const QString &  title,
const QString &  message,
const Qgis::MessageLevel  level = Qgis::MessageLevel::Info 
)
signal

Emitted when a message with title and level must be shown to the user using the parent visible message bar.

Since
QGIS 3.14

◆ refresh

virtual void QgsAbstractDataSourceWidget::refresh ( )
inlinevirtualslot

Triggered when the provider's connections need to be refreshed The default implementation does nothing.

Reimplemented in QgsOWSSourceSelect.

Definition at line 78 of file qgsabstractdatasourcewidget.h.

◆ replaceVectorLayer

void QgsAbstractDataSourceWidget::replaceVectorLayer ( const QString &  oldId,
const QString &  source,
const QString &  name,
const QString &  provider 
)
signal

Emitted when a layer needs to be replaced.

Parameters
oldIdold layer ID
sourceURI of the layer
nameof the layer
providerkey

◆ reset

void QgsAbstractDataSourceWidget::reset ( )
virtualslot

Called when this source select widget is being shown in a "new and clean" dialog.

The data source manager recycles existing source select widgets but will call this method on every reopening. This should clear any selection that has previously been done.

Since
QGIS 3.10

Reimplemented in QgsOWSSourceSelect.

Definition at line 65 of file qgsabstractdatasourcewidget.cpp.

◆ setBrowserModel()

void QgsAbstractDataSourceWidget::setBrowserModel ( QgsBrowserModel model)
virtual

Sets a browser model to use with the widget.

See also
browserModel()
Since
QGIS 3.18

Definition at line 56 of file qgsabstractdatasourcewidget.cpp.

◆ setMapCanvas()

virtual void QgsAbstractDataSourceWidget::setMapCanvas ( QgsMapCanvas mapCanvas)
inlinevirtual

Sets the dialog map canvas.

See also
mapCanvas()

Reimplemented in QgsLayerMetadataSearchWidget, and QgsOWSSourceSelect.

Definition at line 70 of file qgsabstractdatasourcewidget.h.

◆ setupButtons()

void QgsAbstractDataSourceWidget::setupButtons ( QDialogButtonBox *  buttonBox)
protected

Connect the ok and apply/add buttons to the slots.

Definition at line 38 of file qgsabstractdatasourcewidget.cpp.

◆ widgetMode()

QgsProviderRegistry::WidgetMode QgsAbstractDataSourceWidget::widgetMode ( ) const
protected

Returns the widget mode.

Definition at line 28 of file qgsabstractdatasourcewidget.cpp.


The documentation for this class was generated from the following files: