mirror of
https://github.com/qgis/QGIS.git
synced 2025-11-09 00:17:27 -05:00
apply suggestions from review
This commit is contained in:
parent
dc70921448
commit
c159e7cda9
@ -1097,20 +1097,20 @@ QList<QVariant> QgsCategorizedSymbolRendererWidget::layerUniqueValues( const QSt
|
|||||||
if ( idx == -1 )
|
if ( idx == -1 )
|
||||||
{
|
{
|
||||||
// Lets assume it's an expression
|
// Lets assume it's an expression
|
||||||
QgsExpression *expression = new QgsExpression( attrName );
|
QgsExpression expression = QgsExpression( attrName );
|
||||||
QgsExpressionContext context;
|
QgsExpressionContext context;
|
||||||
context << QgsExpressionContextUtils::globalScope()
|
context << QgsExpressionContextUtils::globalScope()
|
||||||
<< QgsExpressionContextUtils::projectScope( QgsProject::instance() )
|
<< QgsExpressionContextUtils::projectScope( QgsProject::instance() )
|
||||||
<< QgsExpressionContextUtils::atlasScope( nullptr )
|
<< QgsExpressionContextUtils::atlasScope( nullptr )
|
||||||
<< QgsExpressionContextUtils::layerScope( mLayer );
|
<< QgsExpressionContextUtils::layerScope( mLayer );
|
||||||
|
|
||||||
expression->prepare( &context );
|
expression.prepare( &context );
|
||||||
QgsFeatureIterator fit = mLayer->getFeatures();
|
QgsFeatureIterator fit = mLayer->getFeatures();
|
||||||
QgsFeature feature;
|
QgsFeature feature;
|
||||||
while ( fit.nextFeature( feature ) )
|
while ( fit.nextFeature( feature ) )
|
||||||
{
|
{
|
||||||
context.setFeature( feature );
|
context.setFeature( feature );
|
||||||
const QVariant value = expression->evaluate( &context );
|
const QVariant value = expression.evaluate( &context );
|
||||||
if ( uniqueValues.contains( value ) )
|
if ( uniqueValues.contains( value ) )
|
||||||
continue;
|
continue;
|
||||||
uniqueValues << value;
|
uniqueValues << value;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user