Skip to content
Permalink
Browse files

Merge pull request #6785 from signedav/fix_conditionalformat_BP

Backport to 3.0 Conditional formatting on relation reference widget
  • Loading branch information
m-kuhn committed Apr 12, 2018
2 parents e516e7c + 55e8380 commit 5ddc4d6ecf8f65a9867d883b933ed937e5db6651
Showing with 5 additions and 10 deletions.
  1. +5 −10 src/core/qgsfeaturefiltermodel.cpp
@@ -448,28 +448,23 @@ QgsConditionalStyle QgsFeatureFilterModel::featureStyle( const QgsFeature &featu
QgsVectorLayer *layer = mSourceLayer;
QgsFeatureId fid = feature.id();
mExpressionContext.setFeature( feature );
QgsConditionalStyle style;

if ( mEntryStylesMap.contains( fid ) )
{
style = mEntryStylesMap.value( fid );
}

auto styles = QgsConditionalStyle::matchingConditionalStyles( layer->conditionalStyles()->rowStyles(), QVariant(), mExpressionContext );

if ( mDisplayExpression.isField() )
if ( mDisplayExpression.referencedColumns().count() == 1 )
{
// Style specific for this field
QString fieldName = *mDisplayExpression.referencedColumns().constBegin();
const auto allStyles = layer->conditionalStyles()->fieldStyles( fieldName );
const auto matchingFieldStyles = QgsConditionalStyle::matchingConditionalStyles( allStyles, feature.attribute( fieldName ), mExpressionContext );

styles += matchingFieldStyles;

style = QgsConditionalStyle::compressStyles( styles );
mEntryStylesMap.insert( fid, style );
}

QgsConditionalStyle style;
style = QgsConditionalStyle::compressStyles( styles );
mEntryStylesMap.insert( fid, style );

return style;
}

0 comments on commit 5ddc4d6

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