QGIS API Documentation 3.41.0-Master (3440c17df1d)
|
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. | |
QgsAbstractProviderConnection (const QString &uri, const QVariantMap &configuration) | |
Creates a new connection from the given uri and configuration. | |
virtual | ~QgsAbstractProviderConnection ()=default |
QVariantMap | configuration () const |
Returns the connection configuration parameters. | |
virtual QIcon | icon () const |
Returns an icon representing the connection. | |
virtual void | remove (const QString &name) const =0 |
Deletes the connection from the settings. | |
void | setConfiguration (const QVariantMap &configuration) |
Sets the connection configuration. | |
void | setUri (const QString &uri) |
Sets the connection data source URI to uri. | |
virtual void | store (const QString &name) const =0 |
Stores the connection in the settings. | |
QString | uri () const |
Returns the connection data source URI string representation. | |
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 42 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.
Implemented in QgsSensorThingsProviderConnection, and QgsTiledSceneProviderConnection.
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 |
Implemented in QgsSensorThingsProviderConnection, and QgsTiledSceneProviderConnection.
QString QgsAbstractProviderConnection::uri | ( | ) | const |
Returns the connection data source URI string representation.
Definition at line 38 of file qgsabstractproviderconnection.cpp.