QGIS API Documentation
3.41.0-Master (3440c17df1d)
Loading...
Searching...
No Matches
src
gui
layertree
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
16
#include "
qgslayertreeembeddedwidgetregistry.h
"
17
18
#include "
qgslayertreeembeddedwidgetsimpl.h
"
19
20
21
QgsLayerTreeEmbeddedWidgetRegistry::QgsLayerTreeEmbeddedWidgetRegistry
()
22
{
23
// populate with default implementations
24
addProvider
(
new
QgsLayerTreeOpacityWidget::Provider() );
25
}
26
27
QgsLayerTreeEmbeddedWidgetRegistry::~QgsLayerTreeEmbeddedWidgetRegistry
()
28
{
29
const
auto
constMProviders =
mProviders
;
30
for
(
QgsLayerTreeEmbeddedWidgetProvider
*
provider
: constMProviders )
31
{
32
removeProvider
(
provider
->
id
() );
33
}
34
}
35
36
QStringList
QgsLayerTreeEmbeddedWidgetRegistry::providers
()
const
37
{
38
return
mProviders
.keys();
39
}
40
41
QgsLayerTreeEmbeddedWidgetProvider
*
QgsLayerTreeEmbeddedWidgetRegistry::provider
(
const
QString &providerId )
const
42
{
43
return
mProviders
.value( providerId );
44
}
45
46
bool
QgsLayerTreeEmbeddedWidgetRegistry::addProvider
(
QgsLayerTreeEmbeddedWidgetProvider
*provider )
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
}
QgsLayerTreeEmbeddedWidgetProvider
Provider interface to be implemented in order to introduce new kinds of embedded widgets for use in l...
Definition
qgslayertreeembeddedwidgetregistry.h:35
QgsLayerTreeEmbeddedWidgetProvider::id
virtual QString id() const =0
Unique name of the provider (among other providers)
QgsLayerTreeEmbeddedWidgetRegistry::providers
QStringList providers() const
Returns list of all registered providers.
Definition
qgslayertreeembeddedwidgetregistry.cpp:36
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
QgsLayerTreeEmbeddedWidgetRegistry::removeProvider
bool removeProvider(const QString &providerId)
Unregister a provider, the provider object is deleted.
Definition
qgslayertreeembeddedwidgetregistry.cpp:55
QgsLayerTreeEmbeddedWidgetRegistry::mProviders
QMap< QString, QgsLayerTreeEmbeddedWidgetProvider * > mProviders
storage of all the providers
Definition
qgslayertreeembeddedwidgetregistry.h:106
QgsLayerTreeEmbeddedWidgetRegistry::provider
QgsLayerTreeEmbeddedWidgetProvider * provider(const QString &providerId) const
Gets provider object from the provider's ID.
Definition
qgslayertreeembeddedwidgetregistry.cpp:41
QgsLayerTreeEmbeddedWidgetRegistry::QgsLayerTreeEmbeddedWidgetRegistry
QgsLayerTreeEmbeddedWidgetRegistry()
Constructor for QgsLayerTreeEmbeddedWidgetRegistry/.
Definition
qgslayertreeembeddedwidgetregistry.cpp:21
qgslayertreeembeddedwidgetregistry.h
qgslayertreeembeddedwidgetsimpl.h
Generated on Sat Nov 23 2024 09:26:05 for QGIS API Documentation by
1.9.8