QGIS API Documentation
3.8.0-Zanzibar (11aff65)
|
A registry / canonical manager of data providers. More...
#include <qgsproviderregistry.h>
Public Types | |
typedef std::map< QString, QgsProviderMetadata * > | Providers |
Type for data provider metadata associative container. More... | |
enum | WidgetMode { None, Embedded, Manager } |
Different ways a source select dialog can be used (embedded is for the data source manager dialog) More... | |
Public Member Functions | |
virtual | ~QgsProviderRegistry () |
QgsDataProvider * | createProvider (const QString &providerKey, const QString &dataSource, const QgsDataProvider::ProviderOptions &options=QgsDataProvider::ProviderOptions()) |
Creates a new instance of a provider. More... | |
QLibrary * | createProviderLibrary (const QString &providerKey) const |
Returns a new QLibrary for the specified providerKey. More... | |
QWidget * | createSelectionWidget (const QString &providerKey, QWidget *parent=nullptr, Qt::WindowFlags fl=Qt::WindowFlags(), QgsProviderRegistry::WidgetMode widgetMode=QgsProviderRegistry::WidgetMode::None) |
Returns a new widget for selecting layers from a provider. More... | |
virtual QString | databaseDrivers () const |
Returns a string containing the available database drivers. More... | |
QVariantMap | decodeUri (const QString &providerKey, const QString &uri) |
Breaks a provider data source URI into its component paths (e.g. More... | |
virtual QString | directoryDrivers () const |
Returns a string containing the available directory drivers. More... | |
virtual QString | fileMeshDatasetFilters () const |
Returns mesh's dataset file filter string. More... | |
virtual QString | fileMeshFilters () const |
Returns mesh file filter string. More... | |
virtual QString | fileRasterFilters () const |
Returns raster file filter string. More... | |
virtual QString | fileVectorFilters () const |
Returns vector file filter string. More... | |
QFunctionPointer | function (const QString &providerKey, const QString &functionName) |
Gets pointer to provider function. More... | |
QString | library (const QString &providerKey) const |
Returns path for the library of the provider. More... | |
QDir | libraryDirectory () const |
Returns the library directory where plugins are found. More... | |
QString | pluginList (bool asHtml=false) const |
Returns list of provider plugins found. More... | |
virtual QString | protocolDrivers () const |
Returns a string containing the available protocol drivers. More... | |
int | providerCapabilities (const QString &providerKey) const |
Returns the provider capabilities. More... | |
QStringList | providerList () const |
Returns list of available providers by their keys. More... | |
const QgsProviderMetadata * | providerMetadata (const QString &providerKey) const |
Returns metadata of the provider or nullptr if not found. More... | |
void | registerGuis (QWidget *widget) |
bool | registerProvider (QgsProviderMetadata *providerMetadata) |
register a new vector data provider from its providerMetadata More... | |
void | setLibraryDirectory (const QDir &path) |
Sets library directory where to search for plugins. More... | |
Static Public Member Functions | |
static QgsProviderRegistry * | instance (const QString &pluginPath=QString()) |
Means of accessing canonical single instance. More... | |
Friends | |
class | QgsApplication |
A registry / canonical manager of data providers.
This is a Singleton class that manages data provider access.
Providers can be either loaded via libraries or native providers that are included in the core QGIS installation and accessed through function pointers.
Loaded providers may be restricted using QGIS_PROVIDER_FILE environment variable. QGIS_PROVIDER_FILE is regexp pattern applied to provider file name (not provider key). For example, if the variable is set to gdal|ogr|postgres it will load only providers gdal, ogr and postgres.
Definition at line 52 of file qgsproviderregistry.h.
typedef std::map<QString, QgsProviderMetadata *> QgsProviderRegistry::Providers |
Type for data provider metadata associative container.
Definition at line 231 of file qgsproviderregistry.h.
Different ways a source select dialog can be used (embedded is for the data source manager dialog)
Enumerator | |
---|---|
None | |
Embedded | |
Manager |
Definition at line 61 of file qgsproviderregistry.h.
|
virtual |
Definition at line 299 of file qgsproviderregistry.cpp.
QgsDataProvider * QgsProviderRegistry::createProvider | ( | const QString & | providerKey, |
const QString & | dataSource, | ||
const QgsDataProvider::ProviderOptions & | options = QgsDataProvider::ProviderOptions() |
||
) |
Creates a new instance of a provider.
providerKey | identifier of the provider |
dataSource | string containing data source for the provider |
options | provider options |
nullptr
on error Definition at line 403 of file qgsproviderregistry.cpp.
QLibrary * QgsProviderRegistry::createProviderLibrary | ( | const QString & | providerKey | ) | const |
Returns a new QLibrary for the specified providerKey.
Ownership of the returned object is transferred to the caller and the caller is responsible for deleting it.
If the provider uses direct provider function pointers instead of a library nullptr
will be returned.
Definition at line 539 of file qgsproviderregistry.cpp.
QWidget * QgsProviderRegistry::createSelectionWidget | ( | const QString & | providerKey, |
QWidget * | parent = nullptr , |
||
Qt::WindowFlags | fl = Qt::WindowFlags() , |
||
QgsProviderRegistry::WidgetMode | widgetMode = QgsProviderRegistry::WidgetMode::None |
||
) |
Returns a new widget for selecting layers from a provider.
Either the parent widget must be set or the caller becomes responsible for deleting the returned widget.
Definition at line 505 of file qgsproviderregistry.cpp.
|
virtual |
Returns a string containing the available database drivers.
Definition at line 614 of file qgsproviderregistry.cpp.
QVariantMap QgsProviderRegistry::decodeUri | ( | const QString & | providerKey, |
const QString & | uri | ||
) |
Breaks a provider data source URI into its component paths (e.g.
file path, layer name).
providerKey | identifier of the provider |
uri | uri string |
Definition at line 469 of file qgsproviderregistry.cpp.
|
virtual |
Returns a string containing the available directory drivers.
Definition at line 619 of file qgsproviderregistry.cpp.
|
virtual |
Returns mesh's dataset file filter string.
Returns a string suitable for a QFileDialog of mesh datasets file formats supported by all data providers.
This walks through all data providers appending calls to their fileMeshFilters to a string, which is then returned.
Definition at line 609 of file qgsproviderregistry.cpp.
|
virtual |
Returns mesh file filter string.
Returns a string suitable for a QFileDialog of mesh file formats supported by all data providers.
This walks through all data providers appending calls to their fileMeshFilters to a string, which is then returned.
Definition at line 604 of file qgsproviderregistry.cpp.
|
virtual |
Returns raster file filter string.
Returns a string suitable for a QFileDialog of raster file formats supported by all data providers.
This walks through all data providers appending calls to their buildSupportedRasterFileFilter to a string, which is then returned.
Definition at line 599 of file qgsproviderregistry.cpp.
|
virtual |
Returns vector file filter string.
Returns a string suitable for a QFileDialog of vector file formats supported by all data providers.
This walks through all data providers appending calls to their fileVectorFilters to a string, which is then returned.
It'd be nice to eventually be raster/vector neutral.
Definition at line 594 of file qgsproviderregistry.cpp.
QFunctionPointer QgsProviderRegistry::function | ( | const QString & | providerKey, |
const QString & | functionName | ||
) |
Gets pointer to provider function.
providerKey | identifier of the provider |
functionName | name of function |
nullptr
on error. If the provider uses direct provider function pointers instead of a library nullptr
will be returned. Definition at line 517 of file qgsproviderregistry.cpp.
|
static |
Means of accessing canonical single instance.
Definition at line 54 of file qgsproviderregistry.cpp.
QString QgsProviderRegistry::library | ( | const QString & | providerKey | ) | const |
Returns path for the library of the provider.
If the provider uses direct provider function pointers instead of a library an empty string will be returned.
Definition at line 332 of file qgsproviderregistry.cpp.
QDir QgsProviderRegistry::libraryDirectory | ( | ) | const |
Returns the library directory where plugins are found.
Definition at line 385 of file qgsproviderregistry.cpp.
QString QgsProviderRegistry::pluginList | ( | bool | asHtml = false | ) | const |
Returns list of provider plugins found.
Definition at line 345 of file qgsproviderregistry.cpp.
|
virtual |
Returns a string containing the available protocol drivers.
Definition at line 624 of file qgsproviderregistry.cpp.
int QgsProviderRegistry::providerCapabilities | ( | const QString & | providerKey | ) | const |
Returns the provider capabilities.
providerKey | identifier of the provider |
Definition at line 485 of file qgsproviderregistry.cpp.
QStringList QgsProviderRegistry::providerList | ( | ) | const |
Returns list of available providers by their keys.
Definition at line 629 of file qgsproviderregistry.cpp.
const QgsProviderMetadata * QgsProviderRegistry::providerMetadata | ( | const QString & | providerKey | ) | const |
Returns metadata of the provider or nullptr
if not found.
Definition at line 639 of file qgsproviderregistry.cpp.
void QgsProviderRegistry::registerGuis | ( | QWidget * | widget | ) |
Definition at line 557 of file qgsproviderregistry.cpp.
bool QgsProviderRegistry::registerProvider | ( | QgsProviderMetadata * | providerMetadata | ) |
register a new vector data provider from its providerMetadata
true
on success, false
if a provider with the same key was already registered Definition at line 573 of file qgsproviderregistry.cpp.
void QgsProviderRegistry::setLibraryDirectory | ( | const QDir & | path | ) |
Sets library directory where to search for plugins.
Definition at line 378 of file qgsproviderregistry.cpp.
|
friend |
Definition at line 304 of file qgsproviderregistry.h.