Skip to content
Permalink
Browse files

[locator] fix display title expression not displayed anymore in the r…

…esults
  • Loading branch information
3nids committed Sep 21, 2020
1 parent 0fb54bc commit 0f2a8341f372b921ab55f14c1ae9ce2dab2ea617
Showing with 8 additions and 3 deletions.
  1. +8 −3 src/app/locator/qgsinbuiltlocatorfilters.cpp
@@ -282,7 +282,7 @@ QStringList QgsActiveLayerFeaturesLocatorFilter::prepare( const QString &string,
QStringList expressionParts;
QStringList completionList;
const QgsFields fields = layer->fields();
QgsAttributeList subsetOfAttributes;
QgsAttributeList subsetOfAttributes = qgis::setToList( mDispExpression.referencedAttributeIndexes( layer->fields() ) );
for ( const QgsField &field : fields )
{
if ( field.configurationFlags().testFlag( QgsField::ConfigurationFlag::NotSearchable ) )
@@ -292,7 +292,11 @@ QStringList QgsActiveLayerFeaturesLocatorFilter::prepare( const QString &string,
continue;

if ( !_fieldRestriction.isEmpty() )
subsetOfAttributes << layer->fields().indexFromName( field.name() );
{
int index = layer->fields().indexFromName( field.name() );
if ( !subsetOfAttributes.contains( index ) )
subsetOfAttributes << index;
}

completionList.append( QStringLiteral( "@%1 " ).arg( field.name() ) );
if ( field.type() == QVariant::String )
@@ -309,7 +313,8 @@ QStringList QgsActiveLayerFeaturesLocatorFilter::prepare( const QString &string,
QString expression = QStringLiteral( "(%1)" ).arg( expressionParts.join( QStringLiteral( " ) OR ( " ) ) );

QgsFeatureRequest req;
req.setFlags( QgsFeatureRequest::NoGeometry );
if ( !mDispExpression.needsGeometry() )
req.setFlags( QgsFeatureRequest::NoGeometry );
req.setFilterExpression( expression );
if ( !_fieldRestriction.isEmpty() )
req.setSubsetOfAttributes( subsetOfAttributes );

0 comments on commit 0f2a834

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