1
- /***************************************************************************
2
- qgsfieldformatter.sip - 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
- ***************************************************************************/
1
+ /************************************************************************
2
+ * This file has been generated automatically from *
3
+ * *
4
+ * src/core/qgsfieldformatter.h *
5
+ * *
6
+ * Do not edit manually ! Edit header and run scripts/sipify.pl again *
7
+ ************************************************************************/
8
+
9
+
10
+
11
+
16
12
class QgsFieldFormatter
17
13
{
14
+ %Docstring
15
+ A field formatter helps to handle and display values for a field.
16
+
17
+ It allows for using a shared configuration with the editor widgets
18
+ for representation of attribute values.
19
+ Field kits normally have one single instance which is managed by the
20
+ QgsFieldFormatterRegistry. Custom field formatters should be registered there and
21
+ field formatters for use within code should normally be obtained from there.
22
+
23
+ This is an abstract base class and will always need to be subclassed.
24
+
25
+ .. versionadded:: 3.0
26
+ %End
27
+
18
28
%TypeHeaderCode
19
29
#include "qgsfieldformatter.h"
20
30
%End
@@ -24,12 +34,64 @@ class QgsFieldFormatter
24
34
virtual ~QgsFieldFormatter();
25
35
26
36
virtual QString id() const = 0;
37
+ %Docstring
38
+ Return a unique id for this field formatter.
39
+ This id will later be used to identify this field formatter in the registry with QgsFieldFormatterRegistry.fieldFormatter().
40
+
41
+ This id matches the id of a QgsEditorWidgetFactory.
42
+ :rtype: str
43
+ %End
44
+
45
+ virtual QString representValue( QgsVectorLayer *layer, int fieldIndex, const QVariantMap &config, const QVariant &cache, const QVariant &value ) const;
46
+ %Docstring
47
+ Create a pretty String representation of the value.
27
48
28
- virtual QString representValue( QgsVectorLayer* layer, int fieldIdx, const QVariantMap& config, const QVariant& cache, const QVariant& value ) const;
49
+ :return: By default the string representation of the provided value as implied by the field definition is returned.
29
50
30
- virtual QVariant sortValue( QgsVectorLayer* vl, int fieldIdx, const QVariantMap& config, const QVariant& cache, const QVariant& value ) const;
51
+ .. versionadded:: 3.0
52
+ :rtype: str
53
+ %End
54
+
55
+ virtual QVariant sortValue( QgsVectorLayer *layer, int fieldIndex, const QVariantMap &config, const QVariant &cache, const QVariant &value ) const;
56
+ %Docstring
57
+ If the default sort order should be overwritten for this widget, you can transform the value in here.
58
+
59
+ :return: an unmodified value by default.
60
+
61
+ .. versionadded:: 3.0
62
+ :rtype: QVariant
63
+ %End
64
+
65
+ virtual Qt::AlignmentFlag alignmentFlag( QgsVectorLayer *layer, int fieldIndex, const QVariantMap &config ) const;
66
+ %Docstring
67
+ Return the alignment for a particular field. By default this will consider the field type but can be overwritten if mapped
68
+ values are represented.
31
69
32
- virtual Qt::AlignmentFlag alignmentFlag( QgsVectorLayer* vl, int fieldIdx, const QVariantMap& config ) const;
70
+ .. versionadded:: 3.0
71
+ :rtype: Qt.AlignmentFlag
72
+ %End
73
+
74
+ virtual QVariant createCache( QgsVectorLayer *layer, int fieldIndex, const QVariantMap &config ) const;
75
+ %Docstring
76
+ Create a cache for a given field.
77
+
78
+ This will be used in situations where a field is being represented various times in a loop. And will be passed
79
+ to other methods on QgsFieldKit and QgsEditorWidgetWrapper.
33
80
34
- virtual QVariant createCache( QgsVectorLayer* vl, int fieldIdx, const QVariantMap& config ) const;
81
+ For example, the attribute table will create a cache once for each field and then use this
82
+ cache for representation. The QgsValueRelationFieldFormatter and QgsValueRelationEditorWidget
83
+ implement this functionality to create a lookuptable once (a QVariantMap / dict) and are
84
+ make use of a cache if present.
85
+
86
+ .. versionadded:: 3.0
87
+ :rtype: QVariant
88
+ %End
35
89
};
90
+
91
+ /************************************************************************
92
+ * This file has been generated automatically from *
93
+ * *
94
+ * src/core/qgsfieldformatter.h *
95
+ * *
96
+ * Do not edit manually ! Edit header and run scripts/sipify.pl again *
97
+ ************************************************************************/
0 commit comments