Skip to content
Permalink
Browse files

Ensure QgsFieldMappingModel uses correct source fields when generatin…

…g contexts
  • Loading branch information
nyalldawson committed Jul 24, 2020
1 parent 014498f commit d255af792eac1bdf7b6d3fa035beebbeb1e2a15e
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 d255af7

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