Skip to content
Permalink
Browse files

Merge pull request #5720 from elpaso/bugfix-17442-null-categories

[bugfix] Categorized style issue using numeric fields with NULL values
  • Loading branch information
elpaso committed Nov 24, 2017
2 parents 8b15c73 + 29abd9d commit cdca0dd17e681bd4aa2994cfdac003208122f563
Showing with 7 additions and 13 deletions.
  1. +7 −13 src/gui/symbology/qgscategorizedsymbolrendererwidget.cpp
@@ -604,28 +604,22 @@ static void _createCategories( QgsCategoryList &cats, QList<QVariant> &values, Q

int num = values.count();

bool hasNull = false;

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

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

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


void QgsCategorizedSymbolRendererWidget::addCategories()
{
QString attrName = mExpressionWidget->currentField();

0 comments on commit cdca0dd

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