Skip to content

Commit

Permalink
Fix current_parent_* for (embedded) feature model
Browse files Browse the repository at this point in the history
  • Loading branch information
nirvn committed Aug 6, 2024
1 parent ab69f60 commit be5843b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
4 changes: 0 additions & 4 deletions src/core/attributeformmodelbase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -253,10 +253,6 @@ void AttributeFormModelBase::resetModel()
void AttributeFormModelBase::applyFeatureModel()
{
mExpressionContext = mFeatureModel->createExpressionContext();
if ( mFeatureModel->linkedParentFeature().isValid() )
{
mExpressionContext << QgsExpressionContextUtils::parentFormScope( mFeatureModel->linkedParentFeature() );
}
mExpressionContext << QgsExpressionContextUtils::formScope( mFeatureModel->feature() );

for ( int i = 0; i < invisibleRootItem()->rowCount(); ++i )
Expand Down
6 changes: 6 additions & 0 deletions src/core/featuremodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include <QJSValue>
#include <QMutex>
#include <qgscurvepolygon.h>
#include <qgsexpressioncontextutils.h>
#include <qgsgeometrycollection.h>
#include <qgsgeometryoptions.h>
#include <qgsmessagelog.h>
Expand Down Expand Up @@ -470,6 +471,11 @@ QgsExpressionContext FeatureModel::createExpressionContext() const
}
expressionContext << ExpressionContextUtils::cloudUserScope( mCloudUserInformation );

if ( mLinkedParentFeature.isValid() )
{
expressionContext << QgsExpressionContextUtils::parentFormScope( mLinkedParentFeature );
}

return expressionContext;
}

Expand Down

1 comment on commit be5843b

@qfield-fairy
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.