Skip to content
Permalink
Browse files

Merge pull request #5747 from elpaso/backport-pr-5720

[bugfix] Categorized style issue using numeric fields with NULL values
  • Loading branch information
elpaso committed Nov 28, 2017
2 parents 2499a20 + cf00925 commit e47a6a55d6217b53f889cf281582826e4945fd0b
Showing with 6 additions and 15 deletions.
  1. +6 −15 src/gui/symbology-ng/qgscategorizedsymbolrendererv2widget.cpp
@@ -630,27 +630,18 @@ static void _createCategories( QgsCategoryList& cats, QList<QVariant>& values, Q
QgsSymbolLayerV2Utils::sortVariantList( values, Qt::AscendingOrder );

int num = values.count();

bool hasNull = false;

for ( int i = 0; i < num; i++ )
{
QVariant value = values[i];
if ( value.toString().isNull() )
if ( ! value.isNull() )
{
hasNull = true;
QgsSymbolV2* newSymbol = symbol->clone();
cats.append( QgsRendererCategoryV2( value, newSymbol, value.toString(), true ) );
}
QgsSymbolV2* newSymbol = symbol->clone();

cats.append( QgsRendererCategoryV2( value, newSymbol, value.toString(), true ) );
}

// add null (default) value if not exists
if ( !hasNull )
{
QgsSymbolV2* newSymbol = symbol->clone();
cats.append( QgsRendererCategoryV2( QVariant( "" ), newSymbol, QString(), true ) );
}
// add null (default) value
QgsSymbolV2* newSymbol = symbol->clone();
cats.append( QgsRendererCategoryV2( QVariant( "" ), newSymbol, QString(), true ) );
}

QgsVectorColorRampV2* QgsCategorizedSymbolRendererV2Widget::getColorRamp()

0 comments on commit e47a6a5

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