28using namespace Qt::StringLiterals;
49 if ( field.
type() == QMetaType::Type::Double &&
50 config.contains( u
"Precision"_s ) &&
54 const double val( value.toDouble( &ok ) );
57 const int precision( config[ u
"Precision"_s ].toInt( &ok ) );
61 result = QLocale().toString( val,
'f', precision );
65 else if ( ( field.
type() == QMetaType::Type::Int ) &&
69 const double val( value.toInt( &ok ) );
72 result = QLocale().toString( val,
'f', 0 );
75 else if ( ( field.
type() == QMetaType::Type::LongLong ) &&
79 const double val( value.toLongLong( &ok ) );
82 result = QLocale().toString( val,
'f', 0 );
87 result = value.toString();
static QString nullRepresentation()
Returns the string used to represent the value NULL throughout QGIS.
Encapsulate a field in an attribute table or data source.
QgsField at(int i) const
Returns the field at particular index (must be in range 0..N-1).
static bool isNull(const QVariant &variant, bool silenceNullWarnings=false)
Returns true if the specified variant should be considered a NULL value.
Represents a vector layer which manages a vector based dataset.