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 )
|
||||
{
|
||||
// Lets assume it's an expression
|
||||
QgsExpression *expression = new QgsExpression( attrName );
|
||||
QgsExpression expression = QgsExpression( attrName );
|
||||
QgsExpressionContext context;
|
||||
context << QgsExpressionContextUtils::globalScope()
|
||||
<< QgsExpressionContextUtils::projectScope( QgsProject::instance() )
|
||||
<< QgsExpressionContextUtils::atlasScope( nullptr )
|
||||
<< QgsExpressionContextUtils::layerScope( mLayer );
|
||||
|
||||
expression->prepare( &context );
|
||||
expression.prepare( &context );
|
||||
QgsFeatureIterator fit = mLayer->getFeatures();
|
||||
QgsFeature feature;
|
||||
while ( fit.nextFeature( feature ) )
|
||||
{
|
||||
context.setFeature( feature );
|
||||
const QVariant value = expression->evaluate( &context );
|
||||
const QVariant value = expression.evaluate( &context );
|
||||
if ( uniqueValues.contains( value ) )
|
||||
continue;
|
||||
uniqueValues << value;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user