QGIS API Documentation  3.16.0-Hannover (43b64b13f3)
qgsdataitemguiproviderregistry.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  qgsdataitemguiproviderregistry.cpp
3  --------------------------------------
4  Date : October 2018
5  Copyright : (C) 2018 by Nyall Dawson
6  Email : nyall dot dawson 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  ***************************************************************************/
16 
17 #include "qgsproviderregistry.h"
18 
19 #include "qgsdataitemguiprovider.h"
20 #include "qgsproviderguiregistry.h"
21 
23 
25 {
26  qDeleteAll( mProviders );
27 }
28 
30 {
31  mProviders.append( provider );
32 }
33 
35 {
36  int index = mProviders.indexOf( provider );
37  if ( index >= 0 )
38  delete mProviders.takeAt( index );
39 }
40 
42 {
43  if ( !providerGuiRegistry )
44  return;
45 
46  const QStringList providersList = providerGuiRegistry->providerList();
47 
48  for ( const QString &key : providersList )
49  {
50  const QList<QgsDataItemGuiProvider *> providerList = providerGuiRegistry->dataItemGuiProviders( key );
51  // the function is a factory - we keep ownership of the returned providers
52  mProviders << providerList;
53  }
54 }
qgsdataitemguiproviderregistry.h
QgsDataItemGuiProvider
Abstract base class for providers which affect how QgsDataItem items behave within the application GU...
Definition: qgsdataitemguiprovider.h:86
QgsDataItemGuiProviderRegistry::removeProvider
void removeProvider(QgsDataItemGuiProvider *provider)
Removes a provider implementation from the registry.
Definition: qgsdataitemguiproviderregistry.cpp:34
qgsdataitemguiprovider.h
QgsDataItemGuiProviderRegistry::initializeFromProviderGuiRegistry
void initializeFromProviderGuiRegistry(QgsProviderGuiRegistry *providerGuiRegistry)
Initializes the registry.
Definition: qgsdataitemguiproviderregistry.cpp:41
qgsproviderguiregistry.h
QgsProviderGuiRegistry::dataItemGuiProviders
virtual const QList< QgsDataItemGuiProvider * > dataItemGuiProviders(const QString &providerKey)
Returns all data item gui providers registered in provider with providerKey.
Definition: qgsproviderguiregistry.cpp:175
QgsDataItemGuiProviderRegistry::addProvider
void addProvider(QgsDataItemGuiProvider *provider)
Adds a provider implementation to the registry.
Definition: qgsdataitemguiproviderregistry.cpp:29
qgsproviderregistry.h
QgsProviderGuiRegistry
A registry / canonical manager of GUI parts of data providers.
Definition: qgsproviderguiregistry.h:50
QgsDataItemGuiProviderRegistry::QgsDataItemGuiProviderRegistry
QgsDataItemGuiProviderRegistry()
QgsDataItemGuiProviderRegistry::~QgsDataItemGuiProviderRegistry
~QgsDataItemGuiProviderRegistry()
Definition: qgsdataitemguiproviderregistry.cpp:24
QgsProviderGuiRegistry::providerList
QStringList providerList() const
Returns list of available providers by their keys.
Definition: qgsproviderguiregistry.cpp:199