QGIS API Documentation
3.14.0-Pi (9f7028fd23)
src
core
fieldformatter
qgslistfieldformatter.cpp
Go to the documentation of this file.
1
/***************************************************************************
2
qgslistfieldformatter.cpp - QgsListFieldFormatter
3
4
---------------------
5
begin : 3.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
#include "
qgslistfieldformatter.h
"
17
#include "
qgsapplication.h
"
18
#include <QSettings>
19
20
QString
QgsListFieldFormatter::id
()
const
21
{
22
return
QStringLiteral(
"List"
);
23
}
24
25
QString
QgsListFieldFormatter::representValue
(
QgsVectorLayer
*layer,
int
fieldIndex,
const
QVariantMap &config,
const
QVariant &cache,
const
QVariant &value )
const
26
{
27
Q_UNUSED( layer )
28
Q_UNUSED( fieldIndex )
29
Q_UNUSED( config )
30
Q_UNUSED( cache )
31
32
if
( value.isNull() )
33
{
34
return
QgsApplication::nullRepresentation
();
35
}
36
37
QString result;
38
const
QVariantList list = value.toList();
39
for
(
const
QVariant &val : list )
40
{
41
if
( !result.isEmpty() )
42
result.append(
", "
);
43
result.append( val.toString() );
44
}
45
return
result;
46
}
QgsListFieldFormatter::id
QString id() const override
Returns a unique id for this field formatter.
Definition:
qgslistfieldformatter.cpp:20
qgsapplication.h
QgsListFieldFormatter::representValue
QString representValue(QgsVectorLayer *layer, int fieldIndex, const QVariantMap &config, const QVariant &cache, const QVariant &value) const override
Create a pretty String representation of the value.
Definition:
qgslistfieldformatter.cpp:25
QgsApplication::nullRepresentation
static QString nullRepresentation()
This string is used to represent the value NULL throughout QGIS.
Definition:
qgsapplication.cpp:1802
QgsVectorLayer
Definition:
qgsvectorlayer.h:385
qgslistfieldformatter.h
Generated on Mon Jun 22 2020 05:14:09 for QGIS API Documentation by
1.8.17