QGIS API Documentation
3.2.0-Bonn (bc43194)
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
Q_FOREACH (
QgsLayerTreeEmbeddedWidgetProvider
*
provider
,
mProviders
)
30
{
31
removeProvider
( provider->
id
() );
32
}
33
}
34
35
QStringList
QgsLayerTreeEmbeddedWidgetRegistry::providers
()
const
36
{
37
return
mProviders
.keys();
38
}
39
40
QgsLayerTreeEmbeddedWidgetProvider
*
QgsLayerTreeEmbeddedWidgetRegistry::provider
(
const
QString &providerId )
const
41
{
42
return
mProviders
.value( providerId );
43
}
44
45
bool
QgsLayerTreeEmbeddedWidgetRegistry::addProvider
(
QgsLayerTreeEmbeddedWidgetProvider
*
provider
)
46
{
47
if
(
mProviders
.contains( provider->
id
() ) )
48
return
false
;
49
50
mProviders
.insert( provider->
id
(),
provider
);
51
return
true
;
52
}
53
54
bool
QgsLayerTreeEmbeddedWidgetRegistry::removeProvider
(
const
QString &providerId )
55
{
56
if
( !
mProviders
.contains( providerId ) )
57
return
false
;
58
59
delete
mProviders
.take( providerId );
60
return
true
;
61
}
QgsLayerTreeEmbeddedWidgetRegistry::addProvider
bool addProvider(QgsLayerTreeEmbeddedWidgetProvider *provider)
Register a provider, takes ownership of the object.
Definition:
qgslayertreeembeddedwidgetregistry.cpp:45
QgsLayerTreeEmbeddedWidgetRegistry::~QgsLayerTreeEmbeddedWidgetRegistry
~QgsLayerTreeEmbeddedWidgetRegistry()
Definition:
qgslayertreeembeddedwidgetregistry.cpp:27
QgsLayerTreeEmbeddedWidgetProvider::id
virtual QString id() const =0
Unique name of the provider (among other providers)
qgslayertreeembeddedwidgetsimpl.h
QgsLayerTreeEmbeddedWidgetRegistry::mProviders
QMap< QString, QgsLayerTreeEmbeddedWidgetProvider * > mProviders
storage of all the providers
Definition:
qgslayertreeembeddedwidgetregistry.h:108
QgsLayerTreeEmbeddedWidgetProvider
Provider interface to be implemented in order to introduce new kinds of embedded widgets for use in l...
Definition:
qgslayertreeembeddedwidgetregistry.h:35
QgsLayerTreeEmbeddedWidgetRegistry::providers
QStringList providers() const
Returns list of all registered providers.
Definition:
qgslayertreeembeddedwidgetregistry.cpp:35
QgsLayerTreeEmbeddedWidgetRegistry::removeProvider
bool removeProvider(const QString &providerId)
Unregister a provider, the provider object is deleted.
Definition:
qgslayertreeembeddedwidgetregistry.cpp:54
qgslayertreeembeddedwidgetregistry.h
QgsLayerTreeEmbeddedWidgetRegistry::provider
QgsLayerTreeEmbeddedWidgetProvider * provider(const QString &providerId) const
Gets provider object from the provider's ID.
Definition:
qgslayertreeembeddedwidgetregistry.cpp:40
QgsLayerTreeEmbeddedWidgetRegistry::QgsLayerTreeEmbeddedWidgetRegistry
QgsLayerTreeEmbeddedWidgetRegistry()
Constructor for QgsLayerTreeEmbeddedWidgetRegistry/.
Definition:
qgslayertreeembeddedwidgetregistry.cpp:21
Generated on Sat Jun 23 2018 20:58:15 for QGIS API Documentation by
1.8.13