Skip to content

Commit

Permalink
fix Qt issue with QString::number and precision 0
Browse files Browse the repository at this point in the history
  • Loading branch information
3nids committed Oct 26, 2018
1 parent e44d5a3 commit 5fa533f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion python/core/auto_generated/qgis.sip.in
Expand Up @@ -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.
Expand Down
6 changes: 3 additions & 3 deletions src/core/qgis.h
Expand Up @@ -20,7 +20,7 @@

#include <QEvent>
#include <QString>
#include <QRegExp>
#include <QRegularExpression>
#include <QMetaType>
#include <QMap>
#include <QMetaEnum>
Expand Down Expand Up @@ -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" ) );
}

/**
Expand Down

0 comments on commit 5fa533f

Please sign in to comment.