Skip to content
Permalink
Browse files

Re-Enable chained filters

  • Loading branch information
m-kuhn committed Oct 25, 2017
1 parent 98bad05 commit 2a185a0c9bce24c400c1ab1ac482df274c1c7992
Showing with 3 additions and 22 deletions.
  1. +3 −22 src/gui/editorwidgets/qgsrelationreferencewidget.cpp
@@ -826,15 +826,14 @@ void QgsRelationReferenceWidget::filterChanged()
QStringList texts;
Q_FOREACH ( const QString &txt, mFilterCache[ccb->property( "Field" ).toString()][ccb->currentText()] )
{
#if 0
QMap<QString, QString> filtersAttrs = filters;
filtersAttrs[fieldName] = QgsExpression::createFieldEqualityExpression( fieldName, txt );
QString expression = filtersAttrs.values().join( QStringLiteral( " AND " ) );

QgsAttributeList subset = attrs;
subset << mReferencedLayer->fields().lookupField( fieldName );

QgsFeatureIterator it( mMasterModel->layerCache()->getFeatures( QgsFeatureRequest().setFilterExpression( expression ).setSubsetOfAttributes( subset ) ) );
QgsFeatureIterator it( mReferencedLayer->getFeatures( QgsFeatureRequest().setFilterExpression( expression ).setSubsetOfAttributes( subset ) ) );

bool found = false;
while ( it.nextFeature( f ) )
@@ -847,7 +846,6 @@ void QgsRelationReferenceWidget::filterChanged()

// item is only provided if at least 1 feature exists
if ( found )
#endif
texts << txt;
}

@@ -861,25 +859,8 @@ void QgsRelationReferenceWidget::filterChanged()
}
}
}
#if 0
if ( !mChainFilters || ( mChainFilters && !filtered ) )
{
filterExpression = filters.values().join( QStringLiteral( " AND " ) );

QgsFeatureRequest req = QgsFeatureRequest().setSubsetOfAttributes( attrs );
if ( !filterExpression.isEmpty() )
req.setFilterExpression( filterExpression );

QgsFeatureIterator it( mMasterModel->layerCache()->getFeatures( req ) );

while ( it.nextFeature( f ) )
{
featureIds << f.id();
}
}

mFilterModel->setFilteredFeatures( featureIds );
#endif
filterExpression = filters.values().join( QStringLiteral( " AND " ) );
mComboBox->setFilterExpression( filterExpression );
}

void QgsRelationReferenceWidget::addEntry()

0 comments on commit 2a185a0

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