QGIS API Documentation 3.99.0-Master (21b3aa880ba)
Loading...
Searching...
No Matches
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
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
30class QgsVectorLayer;
31
40class CORE_EXPORT QgsFieldFormatterRegistry : public QObject
41{
42 Q_OBJECT
43
44 public:
45
51 explicit QgsFieldFormatterRegistry( QObject *parent SIP_TRANSFERTHIS = nullptr );
53
61
66 void removeFieldFormatter( QgsFieldFormatter *formatter );
67
71 void removeFieldFormatter( const QString &id );
72
77 QgsFieldFormatter *fieldFormatter( const QString &id ) const;
78
84
85 signals:
86
91
96
97 private:
98 QHash<QString, QgsFieldFormatter *> mFieldFormatters;
99 std::unique_ptr<QgsFieldFormatter> mFallbackFieldFormatter;
100 mutable QReadWriteLock mLock;
101};
102
103#endif // QGSFIELDKITREGISTRY_H
void fieldFormatterRemoved(QgsFieldFormatter *formatter)
Will be emitted just before a field formatter is removed and deleted.
QgsFieldFormatter * fallbackFieldFormatter() const
Returns a basic fallback field formatter which can be used to represent any field in an unspectacular...
void fieldFormatterAdded(QgsFieldFormatter *formatter)
Will be emitted after a new field formatter has been added.
void removeFieldFormatter(QgsFieldFormatter *formatter)
Remove a field formatter from the registry.
QgsFieldFormatterRegistry(QObject *parent=nullptr)
You should not normally need to create your own field formatter registry.
void addFieldFormatter(QgsFieldFormatter *formatter)
They will take precedence in order of adding them.
QgsFieldFormatter * fieldFormatter(const QString &id) const
Gets a field formatter by its id.
A field formatter helps to handle and display values for a field.
Represents a vector layer which manages a vector based dataset.
#define SIP_TRANSFERTHIS
Definition qgis_sip.h:53
#define SIP_TRANSFER
Definition qgis_sip.h:36