Skip to content
Permalink
Browse files

avoid having qgsDoubleToString printing -0

  • Loading branch information
3nids committed Oct 10, 2018
1 parent eeee43d commit 12ead91ef99649e1baed0a03b802eac2fb5fe5c1
Showing with 2 additions and 2 deletions.
  1. +2 −2 src/core/qgis.h
@@ -20,7 +20,7 @@

#include <QEvent>
#include <QString>
#include <QRegExp>
#include <QRegularExpression>
#include <QMetaType>
#include <QMap>
#include <QMetaEnum>
@@ -239,7 +239,7 @@ CORE_EXPORT uint qHash( const QVariant &variant );
inline QString qgsDoubleToString( double a, int precision = 17 )
{
if ( precision )
return QString::number( a, 'f', precision ).remove( QRegExp( "\\.?0+$" ) );
return QString::number( a, 'f', precision ).remove( QRegularExpression( "\\.?0+$" ) ).replace( QRegularExpression( "^-0$" ), QStringLiteral( "0" ) );
else
return QString::number( a, 'f', precision );
}

0 comments on commit 12ead91

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