QgsAbstractDataSourceWidget class

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.

Derived classes

class QgsOWSSourceSelect
Dialog to create connections and add layers WCS etc.

Constructors, destructors, conversion operators

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

Public functions

void setMapCanvas(const QgsMapCanvas* mapCanvas)
Store a pointer to the map canvas to retrieve extent and CRS Used to select an appropriate CRS and possibly to retrieve data only in the current extent.

Signals

void addDatabaseLayers(const QStringList& paths, const QString& providerKey)
Emitted when a DB layer has been selected for addition.
void addMeshLayer(const QString& url, const QString& baseName, const QString& providerKey)
Emitted when a mesh layer has been selected for addition.
void addRasterLayer(const QString& rasterLayerPath, const QString& baseName, const QString& providerKey)
Emitted when a raster layer has been selected for addition.
void addVectorLayer(const QString& uri, const QString& layerName, const QString& providerKey = QString())
Emitted when a vector layer has been selected for addition.
void addVectorLayers(const QStringList& layerList, const QString& encoding, const QString& dataSourceType)
Emitted when one or more OGR supported layers are selected for addition.
void connectionsChanged()
Emitted when the provider's connections have changed This signal is normally forwarded the app and used to refresh browser items.
void enableButtons(bool enable)
Emitted when the ok/add buttons should be enabled/disabled.
auto progress(int, int) -> Q_DECL_DEPRECATED void deprecated
Emitted when a progress dialog is shown by the provider dialog.
void progressMessage(QString message)
Emitted when a progress dialog is shown by the provider dialog.
void replaceVectorLayer(const QString& oldId, const QString& source, const QString& name, const QString& provider)
Emitted when a layer needs to be replaced.

Public slots

void addButtonClicked() virtual
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.
void refresh() virtual
Triggered when the provider's connections need to be refreshed The default implementation does nothing.

Protected functions

auto addButton() const -> QPushButton*
Returns the add Button.
auto mapCanvas() const -> const QgsMapCanvas*
Returns the map canvas (can be null)
void setupButtons(QDialogButtonBox* buttonBox)
Connect the ok and apply/add buttons to the slots.
auto widgetMode() const -> QgsProviderRegistry::WidgetMode
Returns the widget mode.

Function documentation

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

Emitted when a mesh layer has been selected for addition.

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.

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
layerList list of layers protocol URIs
encoding encoding
dataSourceType string (can be "file" or "database")

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

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

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
oldId old layer ID
source URI of the layer
name of the layer
provider key