QGIS API Documentation 3.41.0-Master (af5edcb665c)
|
The QgsFieldMappingModel holds mapping information for mapping from one set of QgsFields to another, for each set of "destination" fields an expression defines how to obtain the values of the "destination" fields. More...
#include <qgsfieldmappingmodel.h>
Classes | |
struct | Field |
The Field struct holds information about a mapped field. More... | |
Public Types | |
enum class | ColumnDataIndex : int { SourceExpression , DestinationName , DestinationType , DestinationLength , DestinationPrecision , DestinationConstraints , DestinationAlias , DestinationComment } |
The ColumnDataIndex enum represents the column index for the view. More... | |
Public Member Functions | |
QgsFieldMappingModel (const QgsFields &sourceFields=QgsFields(), const QgsFields &destinationFields=QgsFields(), const QMap< QString, QString > &expressions=QMap< QString, QString >(), QObject *parent=nullptr) | |
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. | |
void | appendField (const QgsField &field, const QString &expression=QString()) |
Appends a new field to the model, with an optional expression. | |
int | columnCount (const QModelIndex &parent=QModelIndex()) const override |
QgsExpressionContextGenerator * | contextGenerator () const |
Returns the context generator with the source fields. | |
QVariant | data (const QModelIndex &index, int role) const override |
bool | destinationEditable () const |
Returns true if the destination fields are editable. | |
QMap< QString, QgsProperty > | fieldPropertyMap () const |
Returns a map of destination field name to QgsProperty definition for field value, representing the current status of the model. | |
Qt::ItemFlags | flags (const QModelIndex &index) const override |
QVariant | headerData (int section, Qt::Orientation orientation, int role) const override |
QList< QgsFieldMappingModel::Field > | mapping () const |
Returns a list of Field objects representing the current status of the model. | |
bool | moveDown (const QModelIndex &index) |
Moves up the field at index. | |
bool | moveUp (const QModelIndex &index) |
Moves down the field at index. | |
Q_ENUM (ColumnDataIndex) | |
bool | removeField (const QModelIndex &index) |
Removes the field at index from the model, returns true on success. | |
int | rowCount (const QModelIndex &parent=QModelIndex()) const override |
void | setBaseExpressionContextGenerator (const QgsExpressionContextGenerator *generator) |
Sets the base expression context generator, which will generate the expression contexts for expression based widgets used by the model. | |
bool | setData (const QModelIndex &index, const QVariant &value, int role) override |
void | setDestinationEditable (bool editable) |
Sets the destination fields editable state to editable. | |
void | setDestinationFields (const QgsFields &destinationFields, const QMap< QString, QString > &expressions=QMap< QString, QString >()) |
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. | |
void | setFieldPropertyMap (const QMap< QString, QgsProperty > &map) |
Sets a map of destination field name to QgsProperty definition for field value. | |
void | setSourceFields (const QgsFields &sourceFields) |
Set source fields to sourceFields. | |
QgsFields | sourceFields () const |
Returns a list of source fields. | |
Static Public Member Functions | |
static Q_DECL_DEPRECATED const QMap< QMetaType::Type, QString > | dataTypes () |
Returns a static map of supported data types. | |
static const QList< QgsVectorDataProvider::NativeType > | supportedDataTypes () |
Returns a static list of supported data types. | |
Friends | |
class | QgsAggregateMappingModel |
The QgsFieldMappingModel holds mapping information for mapping from one set of 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.
Definition at line 40 of file qgsfieldmappingmodel.h.
|
strong |
The ColumnDataIndex enum represents the column index for the view.
Definition at line 48 of file qgsfieldmappingmodel.h.
QgsFieldMappingModel::QgsFieldMappingModel | ( | const QgsFields & | sourceFields = QgsFields() , |
const QgsFields & | destinationFields = QgsFields() , |
||
const QMap< QString, QString > & | expressions = QMap<QString, QString>() , |
||
QObject * | parent = nullptr |
||
) |
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.
Definition at line 23 of file qgsfieldmappingmodel.cpp.
void QgsFieldMappingModel::appendField | ( | const QgsField & | field, |
const QString & | expression = QString() |
||
) |
Appends a new field to the model, with an optional expression.
Definition at line 518 of file qgsfieldmappingmodel.cpp.
|
override |
Definition at line 97 of file qgsfieldmappingmodel.cpp.
QgsExpressionContextGenerator * QgsFieldMappingModel::contextGenerator | ( | ) | const |
Returns the context generator with the source fields.
Definition at line 350 of file qgsfieldmappingmodel.cpp.
|
override |
Definition at line 104 of file qgsfieldmappingmodel.cpp.
|
static |
Returns a static map of supported data types.
Definition at line 403 of file qgsfieldmappingmodel.cpp.
bool QgsFieldMappingModel::destinationEditable | ( | ) | const |
Returns true
if the destination fields are editable.
Definition at line 393 of file qgsfieldmappingmodel.cpp.
QMap< QString, QgsProperty > QgsFieldMappingModel::fieldPropertyMap | ( | ) | const |
Returns a map of destination field name to QgsProperty definition for field value, representing the current status of the model.
Definition at line 470 of file qgsfieldmappingmodel.cpp.
|
override |
Definition at line 189 of file qgsfieldmappingmodel.cpp.
|
override |
Definition at line 31 of file qgsfieldmappingmodel.cpp.
QList< QgsFieldMappingModel::Field > QgsFieldMappingModel::mapping | ( | ) | const |
Returns a list of Field objects representing the current status of the model.
Definition at line 465 of file qgsfieldmappingmodel.cpp.
bool QgsFieldMappingModel::moveDown | ( | const QModelIndex & | index | ) |
Moves up the field at index.
Definition at line 551 of file qgsfieldmappingmodel.cpp.
bool QgsFieldMappingModel::moveUp | ( | const QModelIndex & | index | ) |
Moves down the field at index.
Definition at line 546 of file qgsfieldmappingmodel.cpp.
QgsFieldMappingModel::Q_ENUM | ( | ColumnDataIndex | ) |
bool QgsFieldMappingModel::removeField | ( | const QModelIndex & | index | ) |
Removes the field at index from the model, returns true
on success.
Definition at line 531 of file qgsfieldmappingmodel.cpp.
|
override |
Definition at line 90 of file qgsfieldmappingmodel.cpp.
void QgsFieldMappingModel::setBaseExpressionContextGenerator | ( | const QgsExpressionContextGenerator * | generator | ) |
Sets the base expression context generator, which will generate the expression contexts for expression based widgets used by the model.
Definition at line 355 of file qgsfieldmappingmodel.cpp.
|
override |
Definition at line 198 of file qgsfieldmappingmodel.cpp.
void QgsFieldMappingModel::setDestinationEditable | ( | bool | editable | ) |
Sets the destination fields editable state to editable.
Definition at line 398 of file qgsfieldmappingmodel.cpp.
void QgsFieldMappingModel::setDestinationFields | ( | const QgsFields & | destinationFields, |
const QMap< QString, QString > & | expressions = QMap<QString, QString>() |
||
) |
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.
Definition at line 360 of file qgsfieldmappingmodel.cpp.
void QgsFieldMappingModel::setFieldPropertyMap | ( | const QMap< QString, QgsProperty > & | map | ) |
Sets a map of destination field name to QgsProperty definition for field value.
Definition at line 482 of file qgsfieldmappingmodel.cpp.
void QgsFieldMappingModel::setSourceFields | ( | const QgsFields & | sourceFields | ) |
Set source fields to sourceFields.
Definition at line 324 of file qgsfieldmappingmodel.cpp.
QgsFields QgsFieldMappingModel::sourceFields | ( | ) | const |
Returns a list of source fields.
Definition at line 85 of file qgsfieldmappingmodel.cpp.
|
static |
Returns a static list of supported data types.
Definition at line 419 of file qgsfieldmappingmodel.cpp.
|
friend |
Definition at line 213 of file qgsfieldmappingmodel.h.