File: qgsfieldmodel.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 (201 lines) | stat: -rw-r--r-- 5,493 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
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
/************************************************************************
 * This file has been generated automatically from                      *
 *                                                                      *
 * src/core/qgsfieldmodel.h                                             *
 *                                                                      *
 * Do not edit manually ! Edit header and run scripts/sipify.py again   *
 ************************************************************************/






class QgsFieldModel : QAbstractItemModel
{
%Docstring(signature="appended")
The :py:class:`QgsFieldModel` class is a model to display the list of
fields in widgets (optionally associated with a vector layer).

If allowed, expressions might be added to the end of the model. It can
be associated with a :py:class:`QgsMapLayerModel` to dynamically display
a layer and its fields.
%End

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


    enum class CustomRole /BaseType=IntEnum/
    {
      FieldName,
      FieldIndex,
      Expression,
      IsExpression,
      ExpressionValidity,
      FieldType,
      FieldOrigin,
      IsEmpty,
      EditorWidgetType,
      JoinedFieldIsEditable,
      FieldIsWidgetEditable,
    };

    explicit QgsFieldModel( QObject *parent /TransferThis/ = 0 );
%Docstring
Constructor for QgsFieldModel - creates a model to display the fields of
a given layer.
%End

    QModelIndex indexFromName( const QString &fieldName );
%Docstring
Returns the index corresponding to a given fieldName.
%End

    void setAllowExpression( bool allowExpression );
%Docstring
Sets whether custom expressions are accepted and displayed in the model.

.. seealso:: :py:func:`allowExpression`

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

    bool allowExpression();
%Docstring
Returns ``True`` if the model allows custom expressions to be created
and displayed.

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

    void setAllowEmptyFieldName( bool allowEmpty );
%Docstring
Sets whether an optional empty field ("not set") option is present in
the model.

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

    bool allowEmptyFieldName() const;
%Docstring
Returns ``True`` if the model allows the empty field ("not set") choice.

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

    bool isField( const QString &expression ) const;
%Docstring
Returns ``True`` if a string represents a field reference, or ``False``
if it is an expression consisting of more than direct field reference.
%End

    void setExpression( const QString &expression );
%Docstring
Sets a single expression to be added after the fields at the end of the
model.

.. seealso:: :py:func:`setAllowExpression`

.. seealso:: :py:func:`allowExpression`

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

    void removeExpression();
%Docstring
Removes any custom expression from the model.

.. seealso:: :py:func:`setExpression`

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

    QgsVectorLayer *layer();
%Docstring
Returns the layer associated with the model.

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

    virtual QModelIndex index( int row, int column, const QModelIndex &parent = QModelIndex() ) const;

    virtual QModelIndex parent( const QModelIndex &child ) const;

    virtual int rowCount( const QModelIndex &parent = QModelIndex() ) const;

    virtual int columnCount( const QModelIndex &parent ) const;

    virtual QVariant data( const QModelIndex &index, int role ) const;


    static QString fieldToolTip( const QgsField &field );
%Docstring
Returns a HTML formatted tooltip string for a ``field``, containing
details like the field name, alias and type.
%End

    static QString fieldToolTipExtended( const QgsField &field, const QgsVectorLayer *layer );
%Docstring
Returns a HTML formatted tooltip string for a ``field``, containing
details like the field name, alias, type and expression.

.. versionadded:: 3.14
%End

    void setFields( const QgsFields &fields );
%Docstring
Manually sets the ``fields`` to use for the model.

This method should only be used when the model ISN'T associated with a
:py:func:`~QgsFieldModel.layer` and needs to show the fields from an
arbitrary field collection instead. Calling
:py:func:`~QgsFieldModel.setFields` will automatically clear any
existing :py:func:`~QgsFieldModel.layer`.

.. seealso:: :py:func:`fields`

.. versionadded:: 3.14
%End

    QgsFields fields() const;
%Docstring
Returns the fields currently shown in the model.

This will either be fields from the associated
:py:func:`~QgsFieldModel.layer` or the fields manually set by a call to
:py:func:`~QgsFieldModel.setFields`.

.. versionadded:: 3.14
%End

  public slots:

    void setLayer( QgsVectorLayer *layer );
%Docstring
Set the layer from which fields are displayed.

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

  protected slots:

    virtual void updateModel();
%Docstring
Called when the model must be updated.
%End

  protected:


};

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