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( );
152 void invertSelection( );
156 QTableView *mTableView =
nullptr;
157 QAbstractTableModel *mModel =
nullptr;
159 QPointer< QgsVectorLayer > mSourceLayer;
160 void updateColumns();
162 std::list<int> selectedRows( );
172class QgsFieldMappingExpressionDelegate:
public QStyledItemDelegate
178 QgsFieldMappingExpressionDelegate( QObject *parent =
nullptr );
181 QWidget *createEditor( QWidget *parent,
const QStyleOptionViewItem &option,
const QModelIndex &index )
const override;
182 void setEditorData( QWidget *editor,
const QModelIndex &index )
const override;
183 void setModelData( QWidget *editor, QAbstractItemModel *model,
const QModelIndex &index )
const override;
186class QgsFieldMappingTypeDelegate:
public QStyledItemDelegate
192 QgsFieldMappingTypeDelegate( QObject *parent =
nullptr );
195 QWidget *createEditor( QWidget *parent,
const QStyleOptionViewItem &option,
const QModelIndex &index )
const override;
196 void setEditorData( QWidget *editor,
const QModelIndex &index )
const override;
197 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.