QGIS API Documentation  3.22.4-Białowieża (ce8e65e95e)
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  const 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 }
void initializeFromProviderGuiRegistry(QgsProviderGuiRegistry *providerGuiRegistry)
Initializes the registry.
void removeProvider(QgsDataItemGuiProvider *provider)
Removes a provider implementation from the registry.
void addProvider(QgsDataItemGuiProvider *provider)
Adds a provider implementation to the registry.
Abstract base class for providers which affect how QgsDataItem items behave within the application GU...
A registry / canonical manager of GUI parts of data providers.
virtual const QList< QgsDataItemGuiProvider * > dataItemGuiProviders(const QString &providerKey)
Returns all data item gui providers registered in provider with providerKey.
QStringList providerList() const
Returns list of available providers by their keys.