Skip to content
Permalink
Browse files

fix Qt issue with QString::number and precision 0

  • Loading branch information
3nids committed Oct 26, 2018
1 parent e44d5a3 commit 5fa533f1969ae430e9f7ab79e60bad789e28be30
Showing with 4 additions and 4 deletions.
  1. +1 −1 python/core/auto_generated/qgis.sip.in
  2. +3 −3 src/core/qgis.h
@@ -19,7 +19,7 @@ int QgisEvent = QEvent::User + 1;
%End


class Qgis
class QgisQgis
{
%Docstring
The Qgis class provides global constants for use throughout the application.
@@ -20,7 +20,7 @@

#include <QEvent>
#include <QString>
#include <QRegExp>
#include <QRegularExpression>
#include <QMetaType>
#include <QMap>
#include <QMetaEnum>
@@ -239,9 +239,9 @@ 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+$" ) );
else
return QString::number( a, 'f', precision );
return QString::number( a, 'f', precision ).replace( QRegularExpression( "^-0$" ), QLatin1Literal( "0" ) );
}

/**

0 comments on commit 5fa533f

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