16 #ifndef QGSFIELDMAPPINGWIDGET_H
17 #define QGSFIELDMAPPINGWIDGET_H
20 #include <QAbstractTableModel>
21 #include <QStyledItemDelegate>
29 class 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( );
157 class ExpressionDelegate:
public QStyledItemDelegate
162 ExpressionDelegate( QObject *parent =
nullptr );
165 QWidget *createEditor( QWidget *parent,
const QStyleOptionViewItem &option,
const QModelIndex &index )
const override;
166 void setEditorData( QWidget *editor,
const QModelIndex &index )
const override;
167 void setModelData( QWidget *editor, QAbstractItemModel *model,
const QModelIndex &index )
const override;
170 class TypeDelegate:
public QStyledItemDelegate
175 TypeDelegate( QObject *parent =
nullptr );
178 QWidget *createEditor( QWidget *parent,
const QStyleOptionViewItem &option,
const QModelIndex &index )
const override;
179 void setEditorData( QWidget *editor,
const QModelIndex &index )
const override;
180 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.