16 #ifndef QGSFIELDMAPPINGMODEL_H
17 #define QGSFIELDMAPPINGMODEL_H
19 #include <QAbstractTableModel>
20 #include <QStyledItemDelegate>
56 DestinationConstraints,
83 const QMap<QString, QString> &expressions = QMap<QString, QString>(),
84 QObject *parent =
nullptr );
87 bool destinationEditable()
const;
90 void setDestinationEditable(
bool editable );
93 static const QMap<QVariant::Type, QString> dataTypes();
99 QList<QgsFieldMappingModel::Field> mapping()
const;
107 QMap< QString, QgsProperty > fieldPropertyMap()
const;
114 void setFieldPropertyMap(
const QMap< QString, QgsProperty > &map );
117 void appendField(
const QgsField &
field,
const QString &expression = QString() );
120 bool removeField(
const QModelIndex &index );
123 bool moveUp(
const QModelIndex &index );
126 bool moveDown(
const QModelIndex &index );
129 void setSourceFields(
const QgsFields &sourceFields );
145 void setDestinationFields(
const QgsFields &destinationFields,
146 const QMap<QString, QString> &expressions = QMap<QString, QString>() );
149 int rowCount(
const QModelIndex &parent = QModelIndex() )
const override;
150 int columnCount(
const QModelIndex &parent = QModelIndex() )
const override;
151 QVariant data(
const QModelIndex &index,
int role )
const override;
152 QVariant headerData(
int section, Qt::Orientation orientation,
int role )
const override;
153 Qt::ItemFlags flags(
const QModelIndex &index )
const override;
154 bool setData(
const QModelIndex &index,
const QVariant &value,
int role )
override;
163 ExpressionContextGenerator(
const QgsFields &sourceFields );
168 void setSourceFields(
const QgsFields &fields );
179 QgsFieldConstraints::Constraints fieldConstraints(
const QgsField &
field )
const;
181 bool moveUpOrDown(
const QModelIndex &index,
bool up =
true );
194 QList<Field> mMapping;
195 bool mDestinationEditable =
false;
197 std::unique_ptr<ExpressionContextGenerator> mExpressionContextGenerator;
205 #endif // QGSFIELDMAPPINGMODEL_H