Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
avoid having qgsDoubleToString printing -0
- Loading branch information
Showing
with
2 additions
and
2 deletions.
-
+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 ); |
|
|
} |
|
|