16 #ifndef QGSFIELDMAPPINGWIDGET_H
17 #define QGSFIELDMAPPINGWIDGET_H
20 #include <QAbstractTableModel>
21 #include <QStyledItemDelegate>
28 class QItemSelectionModel;
53 const QMap<QString, QString> &expressions = QMap<QString, QString>() );
56 void setDestinationEditable(
bool editable );
59 bool destinationEditable()
const;
65 QList<QgsFieldMappingModel::Field> mapping()
const;
73 QMap< QString, QgsProperty > fieldPropertyMap()
const;
80 void setFieldPropertyMap(
const QMap< QString, QgsProperty > &map );
83 QItemSelectionModel *selectionModel();
86 void setSourceFields(
const QgsFields &sourceFields );
94 void setDestinationFields(
const QgsFields &destinationFields,
95 const QMap<QString, QString> &expressions = QMap<QString, QString>() );
100 void scrollTo(
const QModelIndex &index )
const;
118 void appendField(
const QgsField &field,
const QString &expression = QString() );
121 bool removeSelectedFields( );
124 bool moveSelectedFieldsUp( );
127 bool moveSelectedFieldsDown( );
131 QTableView *mTableView =
nullptr;
132 QAbstractTableModel *mModel =
nullptr;
133 void updateColumns();
135 std::list<int> selectedRows( );
137 class ExpressionDelegate:
public QStyledItemDelegate
142 ExpressionDelegate( QObject *parent =
nullptr );
145 QWidget *createEditor( QWidget *parent,
const QStyleOptionViewItem &option,
const QModelIndex &index )
const override;
146 void setEditorData( QWidget *editor,
const QModelIndex &index )
const override;
147 void setModelData( QWidget *editor, QAbstractItemModel *model,
const QModelIndex &index )
const override;
150 class TypeDelegate:
public QStyledItemDelegate
155 TypeDelegate( QObject *parent =
nullptr );
158 QWidget *createEditor( QWidget *parent,
const QStyleOptionViewItem &option,
const QModelIndex &index )
const override;
159 void setEditorData( QWidget *editor,
const QModelIndex &index )
const override;
160 void setModelData( QWidget *editor, QAbstractItemModel *model,
const QModelIndex &index )
const override;
168 #endif // QGSFIELDMAPPINGWIDGET_H