16#ifndef QGSFIELDMAPPINGWIDGET_H
17#define QGSFIELDMAPPINGWIDGET_H
20#include <QAbstractTableModel>
21#include <QStyledItemDelegate>
29class QItemSelectionModel;
54 void setDestinationEditable(
bool editable );
57 bool destinationEditable()
const;
63 QList<QgsFieldMappingModel::Field> mapping()
const;
71 QMap<QString, QgsProperty> fieldPropertyMap()
const;
78 void setFieldPropertyMap(
const QMap<QString, QgsProperty> &map );
81 QItemSelectionModel *selectionModel();
84 void setSourceFields(
const QgsFields &sourceFields );
108 void setDestinationFields(
const QgsFields &destinationFields,
const QMap<QString, QString> &expressions = QMap<QString, QString>() );
113 void scrollTo(
const QModelIndex &index )
const;
131 void appendField(
const QgsField &field,
const QString &expression = QString() );
134 bool removeSelectedFields();
137 bool moveSelectedFieldsUp();
140 bool moveSelectedFieldsDown();
147 void invertSelection();
150 QTableView *mTableView =
nullptr;
151 QAbstractTableModel *mModel =
nullptr;
153 QPointer<QgsVectorLayer> mSourceLayer;
154 void updateColumns();
156 std::list<int> selectedRows();
165class QgsFieldMappingExpressionDelegate :
public QStyledItemDelegate
170 QgsFieldMappingExpressionDelegate( QObject *parent =
nullptr );
173 QWidget *createEditor( QWidget *parent,
const QStyleOptionViewItem &option,
const QModelIndex &index )
const override;
174 void setEditorData( QWidget *editor,
const QModelIndex &index )
const override;
175 void setModelData( QWidget *editor, QAbstractItemModel *model,
const QModelIndex &index )
const override;
178class QgsFieldMappingTypeDelegate :
public QStyledItemDelegate
183 QgsFieldMappingTypeDelegate( QObject *parent =
nullptr );
186 QWidget *createEditor( QWidget *parent,
const QStyleOptionViewItem &option,
const QModelIndex &index )
const override;
187 void setEditorData( QWidget *editor,
const QModelIndex &index )
const override;
188 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.