QGIS API Documentation
4.3.0-Master (16eddb2670e)
Toggle main menu visibility
Loading...
Searching...
No Matches
src
core
qgsfieldformatterregistry.h
Go to the documentation of this file.
1
/***************************************************************************
2
qgsfieldformatterregistry.h - QgsFieldFormatterRegistry
3
4
---------------------
5
begin : 2.12.2016
6
copyright : (C) 2016 by Matthias Kuhn
7
email : matthias@opengis.ch
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
#ifndef QGSFIELDKITREGISTRY_H
17
#define QGSFIELDKITREGISTRY_H
18
19
#include <memory>
20
21
#include "qgis_core.h"
22
#include "
qgis_sip.h
"
23
#include "
qgsfieldformatter.h
"
24
25
#include <QHash>
26
#include <QObject>
27
#include <QReadWriteLock>
28
#include <QString>
29
30
class
QgsVectorLayer
;
31
40
class
CORE_EXPORT
QgsFieldFormatterRegistry
:
public
QObject
41
{
42
Q_OBJECT
43
44
public
:
50
explicit
QgsFieldFormatterRegistry
( QObject *parent
SIP_TRANSFERTHIS
=
nullptr
);
51
~QgsFieldFormatterRegistry
()
override
;
52
59
void
addFieldFormatter
(
QgsFieldFormatter
*formatter
SIP_TRANSFER
);
60
65
void
removeFieldFormatter
(
QgsFieldFormatter
*formatter );
66
70
void
removeFieldFormatter
(
const
QString &
id
);
71
76
QgsFieldFormatter
*
fieldFormatter
(
const
QString &
id
)
const
;
77
82
QgsFieldFormatter
*
fallbackFieldFormatter
()
const
;
83
84
signals:
85
89
void
fieldFormatterAdded
(
QgsFieldFormatter
*formatter );
90
94
void
fieldFormatterRemoved
(
QgsFieldFormatter
*formatter );
95
96
private
:
97
QHash<QString, QgsFieldFormatter *> mFieldFormatters;
98
std::unique_ptr<QgsFieldFormatter> mFallbackFieldFormatter;
99
mutable
QReadWriteLock mLock;
100
};
101
102
#endif
// QGSFIELDKITREGISTRY_H
QgsFieldFormatterRegistry::fieldFormatterRemoved
void fieldFormatterRemoved(QgsFieldFormatter *formatter)
Will be emitted just before a field formatter is removed and deleted.
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:85
QgsFieldFormatterRegistry::fieldFormatterAdded
void fieldFormatterAdded(QgsFieldFormatter *formatter)
Will be emitted after a new field formatter has been added.
QgsFieldFormatterRegistry::removeFieldFormatter
void removeFieldFormatter(QgsFieldFormatter *formatter)
Remove a field formatter from the registry.
Definition
qgsfieldformatterregistry.cpp:64
QgsFieldFormatterRegistry::QgsFieldFormatterRegistry
QgsFieldFormatterRegistry(QObject *parent=nullptr)
You should not normally need to create your own field formatter registry.
Definition
qgsfieldformatterregistry.cpp:34
QgsFieldFormatterRegistry::addFieldFormatter
void addFieldFormatter(QgsFieldFormatter *formatter)
They will take precedence in order of adding them.
Definition
qgsfieldformatterregistry.cpp:56
QgsFieldFormatterRegistry::fieldFormatter
QgsFieldFormatter * fieldFormatter(const QString &id) const
Gets a field formatter by its id.
Definition
qgsfieldformatterregistry.cpp:79
QgsFieldFormatter
A field formatter helps to handle and display values for a field.
Definition
qgsfieldformatter.h:68
QgsVectorLayer
Represents a vector layer which manages a vector based dataset.
Definition
qgsvectorlayer.h:414
qgis_sip.h
SIP_TRANSFERTHIS
#define SIP_TRANSFERTHIS
Definition
qgis_sip.h:52
SIP_TRANSFER
#define SIP_TRANSFER
Definition
qgis_sip.h:35
qgsfieldformatter.h
Generated on
for QGIS API Documentation by
1.17.0