File: qgsfieldformatter.sip.in

package info (click to toggle)
qgis 3.40.11%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,183,800 kB
  • sloc: cpp: 1,595,841; python: 372,637; xml: 23,474; sh: 3,761; perl: 3,664; ansic: 2,257; sql: 2,137; yacc: 1,068; lex: 577; javascript: 540; lisp: 411; makefile: 154
file content (154 lines) | stat: -rw-r--r-- 4,901 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
/************************************************************************
 * This file has been generated automatically from                      *
 *                                                                      *
 * src/core/qgsfieldformatter.h                                         *
 *                                                                      *
 * Do not edit manually ! Edit header and run scripts/sipify.py again   *
 ************************************************************************/




class QgsFieldFormatterContext
{
%Docstring(signature="appended")
A context for field formatter containing information like the project

.. versionadded:: 3.12
%End

%TypeHeaderCode
#include "qgsfieldformatter.h"
%End
  public:

    QgsFieldFormatterContext();

    QgsProject *project() const;
%Docstring
Returns the project used in field formatter

.. seealso:: :py:func:`setProject`
%End

    void setProject( QgsProject *project );
%Docstring
Sets the ``project`` used in field formatter

.. seealso:: :py:func:`project`
%End

};

class QgsFieldFormatter
{
%Docstring(signature="appended")
A field formatter helps to handle and display values for a field.

It allows for using a shared configuration with the editor widgets for
representation of attribute values. Field kits normally have one single
instance which is managed by the :py:class:`QgsFieldFormatterRegistry`.
Custom field formatters should be registered there and field formatters
for use within code should normally be obtained from there.

This is an abstract base class and will always need to be subclassed.
%End

%TypeHeaderCode
#include "qgsfieldformatter.h"
%End
  public:

    QgsFieldFormatter();

    virtual ~QgsFieldFormatter();

    enum Flag /BaseType=IntEnum/
    {
      CanProvideAvailableValues
    };
    typedef QFlags<QgsFieldFormatter::Flag> Flags;


    virtual QString id() const = 0;
%Docstring
Returns a unique id for this field formatter. This id will later be used
to identify this field formatter in the registry with
:py:func:`QgsFieldFormatterRegistry.fieldFormatter()`.

This id matches the id of a :py:class:`QgsEditorWidgetFactory`.
%End

    virtual QString representValue( QgsVectorLayer *layer, int fieldIndex, const QVariantMap &config, const QVariant &cache, const QVariant &value ) const;
%Docstring
Create a pretty String representation of the value.

:return: By default the string representation of the provided value as
         implied by the field definition is returned.
%End

    virtual QVariant sortValue( QgsVectorLayer *layer, int fieldIndex, const QVariantMap &config, const QVariant &cache, const QVariant &value ) const;
%Docstring
If the default sort order should be overwritten for this widget, you can
transform the value in here.

:return: an unmodified value by default.
%End

    virtual Qt::AlignmentFlag alignmentFlag( QgsVectorLayer *layer, int fieldIndex, const QVariantMap &config ) const;
%Docstring
Returns the alignment for a particular field. By default this will
consider the field type but can be overwritten if mapped values are
represented.
%End

    virtual QVariant createCache( QgsVectorLayer *layer, int fieldIndex, const QVariantMap &config ) const;
%Docstring
Create a cache for a given field.

This will be used in situations where a field is being represented
various times in a loop. And will be passed to other methods on
:py:class:`QgsFieldKit` and :py:class:`QgsEditorWidgetWrapper`.

For example, the attribute table will create a cache once for each field
and then use this cache for representation. The
:py:class:`QgsValueRelationFieldFormatter` and
:py:class:`QgsValueRelationEditorWidget` implement this functionality to
create a lookuptable once (a QVariantMap / dict) and are make use of a
cache if present.
%End


    virtual QVariantList availableValues( const QVariantMap &config, int countLimit, const QgsFieldFormatterContext &context ) const;
%Docstring
Returns a list of the values that would be possible to select with this
widget type On a RelationReference that would be the parents ids or on
ValueMap all the configured keys according to the settings in the
``config``

.. versionadded:: 3.12
%End

    Flags flags() const;
%Docstring
Returns the flags

.. versionadded:: 3.12
%End

    void setFlags( const Flags &flags );
%Docstring
Sets the ``flags``

.. versionadded:: 3.12
%End

};

/************************************************************************
 * This file has been generated automatically from                      *
 *                                                                      *
 * src/core/qgsfieldformatter.h                                         *
 *                                                                      *
 * Do not edit manually ! Edit header and run scripts/sipify.py again   *
 ************************************************************************/