Skip to content
Permalink
Browse files

Conditional formatting on relation reference widget

in case we have additional display expressions there does use the conditional formatting for the row
and in case there is only one fieldname used in the display expression it does use this as well

Fix: #18521
  • Loading branch information
signedav committed Apr 10, 2018
1 parent 7fa9d41 commit 4d984793e91f7429b38a8af90d741e25d6834f5a
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 4d98479

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