File: qgsattributetablemodel.sip.in

package info (click to toggle)
qgis 3.40.10%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,183,672 kB
  • sloc: cpp: 1,595,771; python: 372,544; 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: 161
file content (310 lines) | stat: -rw-r--r-- 8,040 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
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
/************************************************************************
 * This file has been generated automatically from                      *
 *                                                                      *
 * src/gui/attributetable/qgsattributetablemodel.h                      *
 *                                                                      *
 * Do not edit manually ! Edit header and run scripts/sipify.py again   *
 ************************************************************************/





class QgsAttributeTableModel : QAbstractTableModel
{
%Docstring(signature="appended")
A model backed by a :py:class:`QgsVectorLayerCache` which is able to
provide feature/attribute information to a QAbstractItemView.

Is able to generate editor widgets for its QModelIndexes as well. Is
mostly referred to as "master model" within this doc and the source.

\see <a href="http://doc.qt.digia.com/qt/model-view-programming.html">Qt
Model View Programming</a>
%End

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

    enum class CustomRole /BaseType=IntEnum/
    {
      FeatureId,
      FieldIndex,
      User,
      // Insert new values here, SortRole needs to be the last one
      Sort,
    };

  public:
    QgsAttributeTableModel( QgsVectorLayerCache *layerCache, QObject *parent = 0 );
%Docstring
Constructor

:param layerCache: A layer cache to use as backend
:param parent: The parent QObject (owner)
%End

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

%Docstring
Returns the number of rows

:param parent: parent index
%End

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

%Docstring
Returns the number of columns

:param parent: parent index
%End

    virtual QVariant headerData( int section, Qt::Orientation orientation, int role = Qt::DisplayRole ) const;

%Docstring
Returns header data

:param section: required section
:param orientation: horizontal or vertical orientation
:param role: data role
%End

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

%Docstring
Returns data on the given index

:param index: model index
:param role: data role
%End

    virtual bool setData( const QModelIndex &index, const QVariant &value, int role = Qt::EditRole );

%Docstring
Updates data on given index

:param index: model index
:param value: new data value
:param role: data role
%End

    virtual Qt::ItemFlags flags( const QModelIndex &index ) const;

%Docstring
Returns item flags for the index

:param index: model index
%End

    void reload( const QModelIndex &index1, const QModelIndex &index2 );
%Docstring
Reloads the model data between indices

:param index1: start index
:param index2: end index
%End

    virtual bool removeRows( int row, int count, const QModelIndex &parent = QModelIndex() );

%Docstring
Remove rows
%End

    void resetModel();
%Docstring
Resets the model

Alias to :py:func:`~QgsAttributeTableModel.loadLayer`
%End

    int idToRow( QgsFeatureId id ) const;
%Docstring
Maps feature id to table row

:param id: feature id
%End

    QModelIndex idToIndex( QgsFeatureId id ) const;

    QModelIndexList idToIndexList( QgsFeatureId id ) const;

    int fieldIdx( int col ) const;
%Docstring
Gets field index from column
%End

    int fieldCol( int idx ) const;
%Docstring
Gets column from field index
%End

    QgsFeatureId rowToId( int row ) const;
%Docstring
Maps row to feature id

:param row: row number
%End

    void swapRows( QgsFeatureId a, QgsFeatureId b );
%Docstring
Swaps two rows

:param a: first row
:param b: second row
%End

    QgsVectorLayer *layer() const;
%Docstring
Returns the layer this model uses as backend. Retrieved from the layer
cache.
%End

    QgsVectorLayerCache *layerCache() const;
%Docstring
Returns the layer cache this model uses as backend.
%End

    void executeAction( QUuid action, const QModelIndex &idx ) const;
%Docstring
Execute an action
%End

    void executeMapLayerAction( QgsMapLayerAction *action, const QModelIndex &idx, const QgsMapLayerActionContext &context = QgsMapLayerActionContext() ) const;
%Docstring
Execute a :py:class:`QgsMapLayerAction`
%End

    QgsFeature feature( const QModelIndex &idx ) const;
%Docstring
Returns the feature attributes at given model index

:return: feature attributes at given model index
%End

    void prefetchColumnData( int column );
%Docstring
Caches the entire data for one column. This should be called prior to
sorting, so the data does not have to be fetched for every single
comparison. Specify -1 as column to invalidate the cache

:param column: The column index of the field to catch
%End

    void prefetchSortData( const QString &expression, unsigned long cacheIndex = 0 );
%Docstring
Prefetches the entire data for an ``expression``. Based on this cached
information the sorting can later be done in a performant way. A
``cacheIndex`` can be specified if multiple caches should be filled. In
this case, the caches will be available as
``QgsAttributeTableModel.SortRole + cacheIndex``.
%End

    QString sortCacheExpression( unsigned long cacheIndex = 0 ) const;
%Docstring
The expression which was used to fill the sorting cache at index
``cacheIndex``.

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

    void setRequest( const QgsFeatureRequest &request );
%Docstring
Set a request that will be used to fill this attribute table model. In
contrast to a filter, the request will constrain the data shown without
the possibility to dynamically adjust it.

:param request: The request to use to fill this table model.
%End


    const QgsFeatureRequest &request() const;
%Docstring
Gets the the feature request
%End

    void setEditorContext( const QgsAttributeEditorContext &context );
%Docstring
Sets the context in which this table is shown. Will be forwarded to any
editor widget created when editing data on this model.

:param context: The context
%End

    const QgsAttributeEditorContext &editorContext() const;
%Docstring
Returns the context in which this table is shown. Will be forwarded to
any editor widget created when editing data on this model.

:return: The context
%End

    int extraColumns() const;
%Docstring
Empty extra columns to announce from this model. Any extra columns need
to be implemented by proxy models in front of this model.
%End

    void setExtraColumns( int extraColumns );
%Docstring
Empty extra columns to announce from this model. Any extra columns need
to be implemented by proxy models in front of this model.
%End

    bool showValidityState() const;
%Docstring
Returns whether the attribute table will add a visual feedback to cells
when an attribute constraint is not met.

.. versionadded:: 3.30
%End

    void setShowValidityState( bool show );
%Docstring
Sets whether the attribute table will add a visual feedback to cells
when an attribute constraint is not met.

.. versionadded:: 3.30
%End

  public slots:

    virtual void loadLayer();
%Docstring
Loads the layer into the model Preferably to be called, before using
this model as source for any other proxy model
%End

    void fieldConditionalStyleChanged( const QString &fieldName );
%Docstring
Handles updating the model when the conditional style for a field
changes.

:param fieldName: name of field whose conditional style has changed
%End

  signals:

    void modelChanged();
%Docstring
Emitted when the model has been changed.
%End


    void finished();
%Docstring
Emitted when the model has completely loaded all features.
%End

};


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