Skip to content
Permalink
Browse files

labeling: consider configure representation for NULL values (fixes #9998

)
  • Loading branch information
jef-n committed Apr 19, 2014
1 parent 8e6c043 commit e497a5c0f69301a15111c3e99a3ef3337c718f0e
Showing with 9 additions and 3 deletions.
  1. +8 −3 src/core/qgspallabeling.cpp
  2. +1 −0 src/core/qgspallabeling.h
@@ -449,13 +449,17 @@ QgsPalLayerSettings::QgsPalLayerSettings()

// temp stuff for when drawing label components (don't copy)
showingShadowRects = false;

QSettings settings;
mNullValue = settings.value( "qgis/nullValue", "NULL" ).toString();
}

QgsPalLayerSettings::QgsPalLayerSettings( const QgsPalLayerSettings& s )
{
// copy only permanent stuff

enabled = s.enabled;
mNullValue = s.mNullValue;

// text style
fieldName = s.fieldName;
@@ -1702,11 +1706,12 @@ void QgsPalLayerSettings::registerFeature( QgsFeature& f, const QgsRenderContext
QgsDebugMsgLevel( QString( "Expression parser eval error:%1" ).arg( exp->evalErrorString() ), 4 );
return;
}
labelText = result.toString();
labelText = result.isNull() ? mNullValue : result.toString();
}
else
{
labelText = f.attribute( fieldIndex ).toString();
const QVariant &v = f.attribute( fieldIndex );
labelText = v.isNull() ? mNullValue : v.toString();
}

// data defined format numbers?
@@ -1741,7 +1746,7 @@ void QgsPalLayerSettings::registerFeature( QgsFeature& f, const QgsRenderContext
QgsDebugMsgLevel( QString( "exprVal NumPlusSign:%1" ).arg( signPlus ? "true" : "false" ), 4 );
}

QVariant textV = QVariant( labelText );
QVariant textV( labelText );
bool ok;
double d = textV.toDouble( &ok );
if ( ok )
@@ -550,6 +550,7 @@ class CORE_EXPORT QgsPalLayerSettings
QMap<QgsPalLayerSettings::DataDefinedProperties, QPair<QString, int> > mDataDefinedNames;

QFontDatabase mFontDB;
QString mNullValue;
};

class CORE_EXPORT QgsLabelCandidate

0 comments on commit e497a5c

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