Skip to content
Permalink
Browse files

Ensure QgsFieldMappingModel uses correct source fields when generatin…

…g contexts

(cherry picked from commit d255af7)
  • Loading branch information
nyalldawson committed Jul 27, 2020
1 parent 5ef33a5 commit a1937856118f29af7b769bc347bf9dcf22a02ae9
Showing with 9 additions and 1 deletion.
  1. +7 −0 src/gui/qgsfieldmappingmodel.cpp
  2. +2 −1 src/gui/qgsfieldmappingmodel.h
@@ -310,6 +310,8 @@ QString QgsFieldMappingModel::findExpressionForDestinationField( const QgsFieldM
void QgsFieldMappingModel::setSourceFields( const QgsFields &sourceFields )
{
mSourceFields = sourceFields;
if ( mExpressionContextGenerator )
mExpressionContextGenerator->setSourceFields( mSourceFields );
QStringList usedFields;
beginResetModel();
for ( const Field &f : qgis::as_const( mMapping ) )
@@ -525,3 +527,8 @@ void QgsFieldMappingModel::ExpressionContextGenerator::setBaseExpressionContextG
{
mBaseGenerator = generator;
}

void QgsFieldMappingModel::ExpressionContextGenerator::setSourceFields( const QgsFields &fields )
{
mSourceFields = fields;
}
@@ -165,12 +165,13 @@ class GUI_EXPORT QgsFieldMappingModel: public QAbstractTableModel
// QgsExpressionContextGenerator interface
QgsExpressionContext createExpressionContext() const override;
void setBaseExpressionContextGenerator( const QgsExpressionContextGenerator *generator );
void setSourceFields( const QgsFields &fields );

private:

const QgsExpressionContextGenerator *mBaseGenerator = nullptr;

const QgsFields mSourceFields;
QgsFields mSourceFields;

};

0 comments on commit a193785

Please sign in to comment.
You can’t perform that action at this time.