QGIS API Documentation  3.10.0-A Coruña (6c816b4204)
qgsdataitemproviderregistry.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  qgsdataitemproviderregistry.cpp
3  --------------------------------------
4  Date : March 2015
5  Copyright : (C) 2015 by Martin Dobias
6  Email : wonder dot sk at gmail dot com
7  ***************************************************************************
8  * *
9  * This program is free software; you can redistribute it and/or modify *
10  * it under the terms of the GNU General Public License as published by *
11  * the Free Software Foundation; either version 2 of the License, or *
12  * (at your option) any later version. *
13  * *
14  ***************************************************************************/
15 
17 
18 #include "qgsdataitem.h"
19 #include "qgsdataitemprovider.h"
20 #include "qgsdataprovider.h"
21 #include "qgslogger.h"
22 #include "qgsproviderregistry.h"
23 
25 {
26  QStringList providersList = QgsProviderRegistry::instance()->providerList();
27 
28  const auto constProvidersList = providersList;
29  for ( const QString &key : constProvidersList )
30  {
31  QList<QgsDataItemProvider *> providerList = QgsProviderRegistry::instance()->dataItemProviders( key );
32  mProviders << providerList;
33  }
34 }
35 
37 {
38  qDeleteAll( mProviders );
39 }
40 
41 QList<QgsDataItemProvider *> QgsDataItemProviderRegistry::providers() const { return mProviders; }
42 
44 {
45  mProviders.append( provider );
46 }
47 
49 {
50  int index = mProviders.indexOf( provider );
51  if ( index >= 0 )
52  delete mProviders.takeAt( index );
53 }
QList< QgsDataItemProvider *> dataItemProviders(const QString &providerKey) const
Returns list of data item providers of the provider.
static QgsProviderRegistry * instance(const QString &pluginPath=QString())
Means of accessing canonical single instance.
QList< QgsDataItemProvider * > providers() const
Returns the list of available providers.
void removeProvider(QgsDataItemProvider *provider)
Removes a provider implementation from the registry.
void addProvider(QgsDataItemProvider *provider)
Adds a provider implementation to the registry.
QStringList providerList() const
Returns list of available providers by their keys.
This is the interface for those who want to add custom data items to the browser tree.