QGIS API Documentation 3.28.0-Firenze (ed3ad0430f)
Public Member Functions | List of all members
QgsConnectionRegistry Class Reference

A registry for saved data provider connections, allowing retrieval of saved connections by name and provider type. More...

#include <qgsconnectionregistry.h>

Inheritance diagram for QgsConnectionRegistry:
Inheritance graph
[legend]

Public Member Functions

 QgsConnectionRegistry (const QgsConnectionRegistry &other)=delete
 Registry cannot be copied. More...
 
 QgsConnectionRegistry (QObject *parent=nullptr)
 Constructor for QgsConnectionRegistry. More...
 
QgsAbstractProviderConnectioncreateConnection (const QString &name) SIP_THROW(QgsProviderConnectionException)
 Creates a new connection by loading the connection with the given id from the settings. More...
 
QgsConnectionRegistryoperator= (const QgsConnectionRegistry &other)=delete
 Registry cannot be copied. More...
 

Detailed Description

A registry for saved data provider connections, allowing retrieval of saved connections by name and provider type.

QgsConnectionRegistry is not usually directly created, but rather accessed through QgsApplication::connectionRegistry().

Since
QGIS 3.14

Definition at line 38 of file qgsconnectionregistry.h.

Constructor & Destructor Documentation

◆ QgsConnectionRegistry() [1/2]

QgsConnectionRegistry::QgsConnectionRegistry ( QObject *  parent = nullptr)

Constructor for QgsConnectionRegistry.

Definition at line 23 of file qgsconnectionregistry.cpp.

◆ QgsConnectionRegistry() [2/2]

QgsConnectionRegistry::QgsConnectionRegistry ( const QgsConnectionRegistry other)
delete

Registry cannot be copied.

Member Function Documentation

◆ createConnection()

QgsAbstractProviderConnection * QgsConnectionRegistry::createConnection ( const QString &  name)

Creates a new connection by loading the connection with the given id from the settings.

The id string must be of the format "provider://connection_name", e.g. "postgres://my_connection" for the PostgreSQL connection saved as "my_connection".

Ownership is transferred to the caller.

Exceptions
QgsProviderConnectionException

Definition at line 28 of file qgsconnectionregistry.cpp.

◆ operator=()

QgsConnectionRegistry & QgsConnectionRegistry::operator= ( const QgsConnectionRegistry other)
delete

Registry cannot be copied.


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