File: qgsfieldmappingmodel.sip.in

package info (click to toggle)
qgis 3.22.16%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 1,186,020 kB
  • sloc: cpp: 1,275,562; python: 194,091; xml: 15,597; perl: 3,471; sh: 3,368; sql: 2,485; ansic: 2,219; yacc: 1,056; lex: 574; javascript: 504; lisp: 411; makefile: 227
file content (167 lines) | stat: -rw-r--r-- 5,488 bytes parent folder | download
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
/************************************************************************
 * This file has been generated automatically from                      *
 *                                                                      *
 * src/gui/qgsfieldmappingmodel.h                                       *
 *                                                                      *
 * Do not edit manually ! Edit header and run scripts/sipify.pl again   *
 ************************************************************************/




class QgsFieldMappingModel: QAbstractTableModel
{
%Docstring(signature="appended")
The :py:class:`QgsFieldMappingModel` holds mapping information for mapping from one set of :py:class:`QgsFields` to another,
for each set of "destination" fields an expression defines how to obtain the values of the
"destination" fields.
The model can be optionally set "editable" allowing to modify all the fields, by default only
the mapping expression is editable.

.. versionadded:: 3.14
%End

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

    enum class ColumnDataIndex
    {
      SourceExpression,
      DestinationName,
      DestinationType,
      DestinationLength,
      DestinationPrecision,
      DestinationConstraints,
    };


    struct Field
    {
      QString originalName;
      QgsField field;
      QString expression;
    };

    QgsFieldMappingModel( const QgsFields &sourceFields = QgsFields(),
                          const QgsFields &destinationFields = QgsFields(),
                          const QMap<QString, QString> &expressions = QMap<QString, QString>(),
                          QObject *parent = 0 );
%Docstring
Constructs a QgsFieldMappingModel from a set of ``sourceFields``
and ``destinationFields``, initial values for the expressions can be
optionally specified through ``expressions`` which is a map from the original
field name to the corresponding expression. A ``parent`` object
can be also specified.
%End

    bool destinationEditable() const;
%Docstring
Returns ``True`` if the destination fields are editable
%End

    void setDestinationEditable( bool editable );
%Docstring
Sets the destination fields editable state to ``editable``
%End

    static const QMap<QVariant::Type, QString> dataTypes();
%Docstring
Returns a static map of supported data types
%End

    QgsFields sourceFields() const;
%Docstring
Returns a list of source fields
%End

    QList<QgsFieldMappingModel::Field> mapping() const;
%Docstring
Returns a list of Field objects representing the current status of the model
%End

    QMap< QString, QgsProperty > fieldPropertyMap() const;
%Docstring
Returns a map of destination field name to :py:class:`QgsProperty` definition for field value,
representing the current status of the model.

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

    void setFieldPropertyMap( const QMap< QString, QgsProperty > &map );
%Docstring
Sets a map of destination field name to :py:class:`QgsProperty` definition for field value.

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

    void appendField( const QgsField &field, const QString &expression = QString() );
%Docstring
Appends a new ``field`` to the model, with an optional ``expression``
%End

    bool removeField( const QModelIndex &index );
%Docstring
Removes the field at ``index`` from the model, returns ``True`` on success
%End

    bool moveUp( const QModelIndex &index );
%Docstring
Moves down the field at ``index``
%End

    bool moveDown( const QModelIndex &index );
%Docstring
Moves up the field at ``index``
%End

    void setSourceFields( const QgsFields &sourceFields );
%Docstring
Set source fields to ``sourceFields``
%End

    QgsExpressionContextGenerator *contextGenerator() const;
%Docstring
Returns the context generator with the source fields
%End

    void setBaseExpressionContextGenerator( const QgsExpressionContextGenerator *generator );
%Docstring
Sets the base expression context ``generator``, which will generate the expression
contexts for expression based widgets used by the model.
%End

    void setDestinationFields( const QgsFields &destinationFields,
                               const QMap<QString, QString> &expressions = QMap<QString, QString>() );
%Docstring
Set destination fields to ``destinationFields``, initial values for the expressions can be
optionally specified through ``expressions`` which is a map from the original
field name to the corresponding expression.
%End

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

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

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

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

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

    virtual bool setData( const QModelIndex &index, const QVariant &value, int role );


      public:
};



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