16 #ifndef QGSFIELDMAPPINGMODEL_H
17 #define QGSFIELDMAPPINGMODEL_H
19 #include <QAbstractTableModel>
20 #include <QStyledItemDelegate>
57 DestinationConstraints,
84 const QMap<QString, QString> &expressions = QMap<QString, QString>(),
85 QObject *parent =
nullptr );
88 bool destinationEditable()
const;
91 void setDestinationEditable(
bool editable );
97 Q_DECL_DEPRECATED
static const QMap<QVariant::Type, QString> dataTypes();
103 static const QList<QgsVectorDataProvider::NativeType> supportedDataTypes();
109 QList<QgsFieldMappingModel::Field> mapping()
const;
117 QMap< QString, QgsProperty > fieldPropertyMap()
const;
124 void setFieldPropertyMap(
const QMap< QString, QgsProperty > &map );
127 void appendField(
const QgsField &
field,
const QString &expression = QString() );
130 bool removeField(
const QModelIndex &index );
133 bool moveUp(
const QModelIndex &index );
136 bool moveDown(
const QModelIndex &index );
139 void setSourceFields(
const QgsFields &sourceFields );
155 void setDestinationFields(
const QgsFields &destinationFields,
156 const QMap<QString, QString> &expressions = QMap<QString, QString>() );
160 int rowCount(
const QModelIndex &parent = QModelIndex() )
const override;
161 int columnCount(
const QModelIndex &parent = QModelIndex() )
const override;
162 QVariant data(
const QModelIndex &index,
int role )
const override;
163 QVariant headerData(
int section, Qt::Orientation orientation,
int role )
const override;
164 Qt::ItemFlags flags(
const QModelIndex &index )
const override;
165 bool setData(
const QModelIndex &index,
const QVariant &value,
int role )
override;
174 ExpressionContextGenerator(
const QgsFields &sourceFields );
179 void setSourceFields(
const QgsFields &fields );
190 QgsFieldConstraints::Constraints fieldConstraints(
const QgsField &
field )
const;
196 static const QString qgsFieldToTypeName(
const QgsField &
field );
202 static void setFieldTypeFromName(
QgsField &
field,
const QString &name );
204 bool moveUpOrDown(
const QModelIndex &index,
bool up =
true );
217 QList<Field> mMapping;
218 bool mDestinationEditable =
false;
220 std::unique_ptr<ExpressionContextGenerator> mExpressionContextGenerator;
228 #endif // QGSFIELDMAPPINGMODEL_H