QGIS API Documentation  3.9.0-Master (224899f119)
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 : 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 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:
44 
45  virtual ~QgsFieldFormatter() = default;
46 
53  virtual QString id() const = 0;
54 
62  virtual QString representValue( QgsVectorLayer *layer, int fieldIndex, const QVariantMap &config, const QVariant &cache, const QVariant &value ) const;
63 
71  virtual QVariant sortValue( QgsVectorLayer *layer, int fieldIndex, const QVariantMap &config, const QVariant &cache, const QVariant &value ) const;
72 
79  virtual Qt::AlignmentFlag alignmentFlag( QgsVectorLayer *layer, int fieldIndex, const QVariantMap &config ) const;
80 
94  virtual QVariant createCache( QgsVectorLayer *layer, int fieldIndex, const QVariantMap &config ) const;
95 };
96 
97 #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.