16#ifndef QGSFIELDMAPPINGWIDGET_H
17#define QGSFIELDMAPPINGWIDGET_H
20#include <QAbstractTableModel>
21#include <QStyledItemDelegate>
29class QItemSelectionModel;
55 const QMap<QString, QString> &expressions = QMap<QString, QString>() );
58 void setDestinationEditable(
bool editable );
61 bool destinationEditable()
const;
67 QList<QgsFieldMappingModel::Field> mapping()
const;
75 QMap< QString, QgsProperty > fieldPropertyMap()
const;
82 void setFieldPropertyMap(
const QMap< QString, QgsProperty > &map );
85 QItemSelectionModel *selectionModel();
88 void setSourceFields(
const QgsFields &sourceFields );
112 void setDestinationFields(
const QgsFields &destinationFields,
113 const QMap<QString, QString> &expressions = QMap<QString, QString>() );
118 void scrollTo(
const QModelIndex &index )
const;
136 void appendField(
const QgsField &
field,
const QString &expression = QString() );
139 bool removeSelectedFields( );
142 bool moveSelectedFieldsUp( );
145 bool moveSelectedFieldsDown( );
149 QTableView *mTableView =
nullptr;
150 QAbstractTableModel *mModel =
nullptr;
152 QPointer< QgsVectorLayer > mSourceLayer;
153 void updateColumns();
155 std::list<int> selectedRows( );
165class QgsFieldMappingExpressionDelegate:
public QStyledItemDelegate
171 QgsFieldMappingExpressionDelegate( QObject *parent =
nullptr );
174 QWidget *createEditor( QWidget *parent,
const QStyleOptionViewItem &option,
const QModelIndex &index )
const override;
175 void setEditorData( QWidget *editor,
const QModelIndex &index )
const override;
176 void setModelData( QWidget *editor, QAbstractItemModel *model,
const QModelIndex &index )
const override;
179class QgsFieldMappingTypeDelegate:
public QStyledItemDelegate
185 QgsFieldMappingTypeDelegate( QObject *parent =
nullptr );
188 QWidget *createEditor( QWidget *parent,
const QStyleOptionViewItem &option,
const QModelIndex &index )
const override;
189 void setEditorData( QWidget *editor,
const QModelIndex &index )
const override;
190 void setModelData( QWidget *editor, QAbstractItemModel *model,
const QModelIndex &index )
const override;
Abstract interface for generating an expression context.
The QgsFieldMappingModel holds mapping information for mapping from one set of QgsFields to another,...
Encapsulate a field in an attribute table or data source.
Container of fields for a vector layer.
Represents a vector layer which manages a vector based data sets.