QGIS API Documentation
3.14.0-Pi (9f7028fd23)
src
core
qgsfieldformatterregistry.cpp
Go to the documentation of this file.
1
/***************************************************************************
2
qgsfieldformatterregistry.cpp - QgsFieldFormatterRegistry
3
4
---------------------
5
begin : 2.12.2016
6
copyright : (C) 2016 by Matthias Kuhn
7
email :
[email protected]
8
***************************************************************************
9
* *
10
* This program is free software; you can redistribute it and/or modify *
11
* it under the terms of the GNU General Public License as published by *
12
* the Free Software Foundation; either version 2 of the License, or *
13
* (at your option) any later version. *
14
* *
15
***************************************************************************/
16
17
#include "
qgsfieldformatterregistry.h
"
18
#include "
qgsfieldformatter.h
"
19
20
#include "
qgsvaluerelationfieldformatter.h
"
21
#include "
qgsvaluemapfieldformatter.h
"
22
#include "
qgsdatetimefieldformatter.h
"
23
#include "
qgsrelationreferencefieldformatter.h
"
24
#include "
qgskeyvaluefieldformatter.h
"
25
#include "
qgslistfieldformatter.h
"
26
#include "
qgsrangefieldformatter.h
"
27
#include "
qgscheckboxfieldformatter.h
"
28
#include "
qgsfallbackfieldformatter.h
"
29
30
31
QgsFieldFormatterRegistry::QgsFieldFormatterRegistry
( QObject *parent )
32
: QObject( parent )
33
{
34
addFieldFormatter
(
new
QgsValueRelationFieldFormatter
() );
35
addFieldFormatter
(
new
QgsValueMapFieldFormatter
() );
36
addFieldFormatter
(
new
QgsRelationReferenceFieldFormatter
() );
37
addFieldFormatter
(
new
QgsKeyValueFieldFormatter
() );
38
addFieldFormatter
(
new
QgsListFieldFormatter
() );
39
addFieldFormatter
(
new
QgsDateTimeFieldFormatter
() );
40
addFieldFormatter
(
new
QgsRangeFieldFormatter
() );
41
addFieldFormatter
(
new
QgsCheckBoxFieldFormatter
() );
42
43
mFallbackFieldFormatter =
new
QgsFallbackFieldFormatter
();
44
}
45
46
QgsFieldFormatterRegistry::~QgsFieldFormatterRegistry
()
47
{
48
qDeleteAll( mFieldFormatters );
49
delete
mFallbackFieldFormatter;
50
}
51
52
void
QgsFieldFormatterRegistry::addFieldFormatter
(
QgsFieldFormatter
*
formatter
)
53
{
54
mFieldFormatters.insert(
formatter
->id(),
formatter
);
55
emit
fieldFormatterAdded
(
formatter
);
56
}
57
58
void
QgsFieldFormatterRegistry::removeFieldFormatter
(
QgsFieldFormatter
*
formatter
)
59
{
60
removeFieldFormatter
(
formatter
->id() );
61
}
62
63
void
QgsFieldFormatterRegistry::removeFieldFormatter
(
const
QString &
id
)
64
{
65
if
(
QgsFieldFormatter
*
formatter
= mFieldFormatters.take(
id
) )
66
{
67
emit
fieldFormatterRemoved
(
formatter
);
68
delete
formatter
;
69
}
70
}
71
72
QgsFieldFormatter
*
QgsFieldFormatterRegistry::fieldFormatter
(
const
QString &
id
)
const
73
{
74
return
mFieldFormatters.value(
id
, mFallbackFieldFormatter );
75
}
76
77
QgsFieldFormatter
*
QgsFieldFormatterRegistry::fallbackFieldFormatter
()
const
78
{
79
return
mFallbackFieldFormatter;
80
}
formatter
Definition:
qgsbasicnumericformat.cpp:24
qgsvaluerelationfieldformatter.h
QgsListFieldFormatter
Definition:
qgslistfieldformatter.h:30
QgsFieldFormatterRegistry::QgsFieldFormatterRegistry
QgsFieldFormatterRegistry(QObject *parent=nullptr)
You should not normally need to create your own field formatter registry.
Definition:
qgsfieldformatterregistry.cpp:31
qgskeyvaluefieldformatter.h
qgsfieldformatterregistry.h
QgsFieldFormatterRegistry::fieldFormatterRemoved
void fieldFormatterRemoved(QgsFieldFormatter *formatter)
Will be emitted just before a field formatter is removed and deleted.
QgsFallbackFieldFormatter
Definition:
qgsfallbackfieldformatter.h:29
qgsfallbackfieldformatter.h
QgsRangeFieldFormatter
Definition:
qgsrangefieldformatter.h:28
QgsCheckBoxFieldFormatter
Definition:
qgscheckboxfieldformatter.h:29
qgsvaluemapfieldformatter.h
qgsrangefieldformatter.h
QgsKeyValueFieldFormatter
Definition:
qgskeyvaluefieldformatter.h:33
QgsFieldFormatterRegistry::removeFieldFormatter
void removeFieldFormatter(QgsFieldFormatter *formatter)
Remove a field formatter from the registry.
Definition:
qgsfieldformatterregistry.cpp:58
QgsRelationReferenceFieldFormatter
Definition:
qgsrelationreferencefieldformatter.h:30
qgsdatetimefieldformatter.h
qgsrelationreferencefieldformatter.h
QgsFieldFormatterRegistry::fieldFormatterAdded
void fieldFormatterAdded(QgsFieldFormatter *formatter)
Will be emitted after a new field formatter has been added.
QgsFieldFormatterRegistry::~QgsFieldFormatterRegistry
~QgsFieldFormatterRegistry() override
Definition:
qgsfieldformatterregistry.cpp:46
QgsValueMapFieldFormatter
Definition:
qgsvaluemapfieldformatter.h:39
QgsFieldFormatterRegistry::fallbackFieldFormatter
QgsFieldFormatter * fallbackFieldFormatter() const
Returns a basic fallback field formatter which can be used to represent any field in an unspectacular...
Definition:
qgsfieldformatterregistry.cpp:77
QgsFieldFormatterRegistry::fieldFormatter
QgsFieldFormatter * fieldFormatter(const QString &id) const
Gets a field formatter by its id.
Definition:
qgsfieldformatterregistry.cpp:72
QgsValueRelationFieldFormatter
Definition:
qgsvaluerelationfieldformatter.h:36
QgsFieldFormatterRegistry::addFieldFormatter
void addFieldFormatter(QgsFieldFormatter *formatter)
They will take precedence in order of adding them.
Definition:
qgsfieldformatterregistry.cpp:52
qgscheckboxfieldformatter.h
QgsDateTimeFieldFormatter
Definition:
qgsdatetimefieldformatter.h:30
qgslistfieldformatter.h
QgsFieldFormatter
Definition:
qgsfieldformatter.h:72
qgsfieldformatter.h
Generated on Mon Jun 22 2020 05:14:09 for QGIS API Documentation by
1.8.17