QGIS API Documentation  3.4.15-Madeira (e83d02e274)
qgsfieldformatter.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsfieldformatter.h - QgsFieldFormatter
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 #ifndef QGSFIELDKIT_H
17 #define QGSFIELDKIT_H
18 
19 #include <QString>
20 #include <QVariant>
21 
22 #include "qgis_core.h"
23 
24 class QgsVectorLayer;
25 
40 class CORE_EXPORT QgsFieldFormatter
41 {
42  public:
43 
47  QgsFieldFormatter() = default;
48 
49  virtual ~QgsFieldFormatter() = default;
50 
57  virtual QString id() const = 0;
58 
66  virtual QString representValue( QgsVectorLayer *layer, int fieldIndex, const QVariantMap &config, const QVariant &cache, const QVariant &value ) const;
67 
75  virtual QVariant sortValue( QgsVectorLayer *layer, int fieldIndex, const QVariantMap &config, const QVariant &cache, const QVariant &value ) const;
76 
83  virtual Qt::AlignmentFlag alignmentFlag( QgsVectorLayer *layer, int fieldIndex, const QVariantMap &config ) const;
84 
98  virtual QVariant createCache( QgsVectorLayer *layer, int fieldIndex, const QVariantMap &config ) const;
99 };
100 
101 #endif // QGSFIELDKIT_H
A field formatter helps to handle and display values for a field.
Represents a vector layer which manages a vector based data sets.