QGIS API Documentation
3.20.0-Odense (decaadbb31)
|
The QgsAbstractProviderConnection provides an interface for data provider connections. More...
#include <qgsabstractproviderconnection.h>
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... | |
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.
Definition at line 44 of file qgsabstractproviderconnection.h.
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::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.
Definition at line 26 of file qgsabstractproviderconnection.cpp.
|
virtualdefault |
QVariantMap QgsAbstractProviderConnection::configuration | ( | ) | const |
Returns the connection configuration parameters.
Definition at line 48 of file qgsabstractproviderconnection.cpp.
|
virtual |
Returns an icon representing the connection.
Definition at line 33 of file qgsabstractproviderconnection.cpp.
|
pure virtual |
Deletes the connection from the settings.
void QgsAbstractProviderConnection::setConfiguration | ( | const QVariantMap & | configuration | ) |
Sets the connection configuration.
Definition at line 53 of file qgsabstractproviderconnection.cpp.
void QgsAbstractProviderConnection::setUri | ( | const QString & | uri | ) |
Sets the connection data source URI to uri.
Definition at line 43 of file qgsabstractproviderconnection.cpp.
|
pure virtual |
Stores the connection in the settings.
name | the name under which the connection will be stored |
QString QgsAbstractProviderConnection::uri | ( | ) | const |
Returns the connection data source URI string representation.
Definition at line 38 of file qgsabstractproviderconnection.cpp.