QGIS API Documentation  3.13.0-Master (b73bd58cfb)
Public Member Functions | List of all members
QgsAbstractProviderConnection Class Referenceabstract

The QgsAbstractProviderConnection provides an interface for data provider connections. More...

#include <qgsabstractproviderconnection.h>

Inheritance diagram for QgsAbstractProviderConnection:
Inheritance graph
[legend]

Public Member Functions

 QgsAbstractProviderConnection (const QString &name)
 Creates a new connection with name by reading its configuration from the settings. More...
 
 QgsAbstractProviderConnection (const QString &uri, const QVariantMap &configuration)
 Creates a new connection from the given uri and configuration. More...
 
virtual ~QgsAbstractProviderConnection ()=default
 
QVariantMap configuration () const
 Returns the connection configuration parameters. More...
 
virtual QIcon icon () const
 Returns an icon representing the connection. More...
 
virtual void remove (const QString &name) const =0
 Deletes the connection from the settings. More...
 
void setConfiguration (const QVariantMap &configuration)
 Sets the connection configuration. More...
 
void setUri (const QString &uri)
 Sets the connection data source URI to uri. More...
 
virtual void store (const QString &name) const =0
 Stores the connection in the settings. More...
 
QString uri () const
 Returns the connection data source URI string representation. More...
 

Detailed Description

The QgsAbstractProviderConnection provides an interface for data provider connections.

Connections objects can be constructed loading them from the connections stored in the settings by passing the connection name. A new connection object can also be created by passing a data source URI in the constructor.

Provider metadata keep a cache of the existing connections, to manage stored connections it is recommendend to call metadata methods instead of loading and storing the connections directly.

Concrete classes must implement methods to retrieve, save and remove connections from the settings.

Since
QGIS 3.10

Definition at line 44 of file qgsabstractproviderconnection.h.

Constructor & Destructor Documentation

◆ QgsAbstractProviderConnection() [1/2]

QgsAbstractProviderConnection::QgsAbstractProviderConnection ( const QString &  name)

Creates a new connection with name by reading its configuration from the settings.

If a connection with this name cannot be found, an empty connection will be returned.

Definition at line 19 of file qgsabstractproviderconnection.cpp.

◆ QgsAbstractProviderConnection() [2/2]

QgsAbstractProviderConnection::QgsAbstractProviderConnection ( const QString &  uri,
const QVariantMap &  configuration 
)

Creates a new connection from the given uri and configuration.

The connection is not automatically stored in the settings.

See also
store()

Definition at line 26 of file qgsabstractproviderconnection.cpp.

◆ ~QgsAbstractProviderConnection()

virtual QgsAbstractProviderConnection::~QgsAbstractProviderConnection ( )
virtualdefault

Member Function Documentation

◆ configuration()

QVariantMap QgsAbstractProviderConnection::configuration ( ) const

Returns the connection configuration parameters.

Definition at line 48 of file qgsabstractproviderconnection.cpp.

◆ icon()

QIcon QgsAbstractProviderConnection::icon ( ) const
virtual

Returns an icon representing the connection.

Definition at line 33 of file qgsabstractproviderconnection.cpp.

◆ remove()

virtual void QgsAbstractProviderConnection::remove ( const QString &  name) const
pure virtual

Deletes the connection from the settings.

◆ setConfiguration()

void QgsAbstractProviderConnection::setConfiguration ( const QVariantMap &  configuration)

Sets the connection configuration.

Definition at line 53 of file qgsabstractproviderconnection.cpp.

◆ setUri()

void QgsAbstractProviderConnection::setUri ( const QString &  uri)

Sets the connection data source URI to uri.

Definition at line 43 of file qgsabstractproviderconnection.cpp.

◆ store()

virtual void QgsAbstractProviderConnection::store ( const QString &  name) const
pure virtual

Stores the connection in the settings.

Parameters
namethe name under which the connection will be stored

◆ uri()

QString QgsAbstractProviderConnection::uri ( ) const

Returns the connection data source URI string representation.

Definition at line 38 of file qgsabstractproviderconnection.cpp.


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