QGIS API Documentation  3.26.3-Buenos Aires (65e4edfdad)
qgslayertreeembeddedwidgetregistry.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  qgslayertreeembeddedwidgetregistry.cpp
3  --------------------------------------
4  Date : May 2016
5  Copyright : (C) 2016 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 
19 
20 
22 {
23  // populate with default implementations
24  addProvider( new QgsLayerTreeOpacityWidget::Provider() );
25 }
26 
28 {
29  const auto constMProviders = mProviders;
30  for ( QgsLayerTreeEmbeddedWidgetProvider *provider : constMProviders )
31  {
33  }
34 }
35 
37 {
38  return mProviders.keys();
39 }
40 
42 {
43  return mProviders.value( providerId );
44 }
45 
47 {
48  if ( mProviders.contains( provider->id() ) )
49  return false;
50 
51  mProviders.insert( provider->id(), provider );
52  return true;
53 }
54 
55 bool QgsLayerTreeEmbeddedWidgetRegistry::removeProvider( const QString &providerId )
56 {
57  if ( !mProviders.contains( providerId ) )
58  return false;
59 
60  delete mProviders.take( providerId );
61  return true;
62 }
QgsLayerTreeEmbeddedWidgetRegistry::providers
QStringList providers() const
Returns list of all registered providers.
Definition: qgslayertreeembeddedwidgetregistry.cpp:36
qgslayertreeembeddedwidgetregistry.h
QgsLayerTreeEmbeddedWidgetRegistry::removeProvider
bool removeProvider(const QString &providerId)
Unregister a provider, the provider object is deleted.
Definition: qgslayertreeembeddedwidgetregistry.cpp:55
QgsLayerTreeEmbeddedWidgetRegistry::provider
QgsLayerTreeEmbeddedWidgetProvider * provider(const QString &providerId) const
Gets provider object from the provider's ID.
Definition: qgslayertreeembeddedwidgetregistry.cpp:41
QgsLayerTreeEmbeddedWidgetProvider
Provider interface to be implemented in order to introduce new kinds of embedded widgets for use in l...
Definition: qgslayertreeembeddedwidgetregistry.h:35
QgsLayerTreeEmbeddedWidgetRegistry::QgsLayerTreeEmbeddedWidgetRegistry
QgsLayerTreeEmbeddedWidgetRegistry()
Constructor for QgsLayerTreeEmbeddedWidgetRegistry/.
Definition: qgslayertreeembeddedwidgetregistry.cpp:21
QgsLayerTreeEmbeddedWidgetProvider::id
virtual QString id() const =0
Unique name of the provider (among other providers)
QgsLayerTreeEmbeddedWidgetRegistry::addProvider
bool addProvider(QgsLayerTreeEmbeddedWidgetProvider *provider)
Register a provider, takes ownership of the object.
Definition: qgslayertreeembeddedwidgetregistry.cpp:46
QgsLayerTreeEmbeddedWidgetRegistry::~QgsLayerTreeEmbeddedWidgetRegistry
~QgsLayerTreeEmbeddedWidgetRegistry()
Definition: qgslayertreeembeddedwidgetregistry.cpp:27
qgslayertreeembeddedwidgetsimpl.h
QgsLayerTreeEmbeddedWidgetRegistry::mProviders
QMap< QString, QgsLayerTreeEmbeddedWidgetProvider * > mProviders
storage of all the providers
Definition: qgslayertreeembeddedwidgetregistry.h:110