Skip to content

Commit

Permalink
add scientific notation for double type when precision is mentionned
Browse files Browse the repository at this point in the history
  • Loading branch information
speillet committed Jan 17, 2020
1 parent c343207 commit 87bb68b
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/core/qgsfield.cpp
Expand Up @@ -224,7 +224,14 @@ QString QgsField::displayString( const QVariant &v ) const
{
if ( d->precision > 0 )
{
return QLocale().toString( v.toDouble(), 'f', d->precision );
if ( -1 < v.toDouble() && v.toDouble() < 1 )
{
return QLocale().toString( v.toDouble(), 'g', d->precision );
}
else
{
return QLocale().toString( v.toDouble(), 'f', d->precision );
}
}
else
{
Expand Down

0 comments on commit 87bb68b

Please sign in to comment.