Skip to content
Permalink
Browse files

[bugfix] Categorized style issue using numeric fields with NULL values

Backported from master PR 5720

Fixes #17442
  • Loading branch information
elpaso committed Nov 27, 2017
1 parent 5631094 commit cf009252d5459e5c251de1439d50ba4fb9615baf
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 cf00925

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