Bug report #12947
qgsDoubleToString in Qgis.h error
Status: | Closed | ||
---|---|---|---|
Priority: | High | ||
Assignee: | - | ||
Category: | - | ||
Affected QGIS version: | 2.8.2 | Regression?: | No |
Operating System: | Easy fix?: | No | |
Pull Request or Patch supplied: | No | Resolution: | |
Crashes QGIS or corrupts data: | No | Copied to github as #: | 21027 |
Description
If precision is 0 the number 12000 becomes "12", probably the solution is:
inline QString qgsDoubleToString( const double &a, const int &precision = 17 )
{
if(precision)
return QString::number( a, 'f', precision ).remove( QRegExp( "\\\\.?0+$" ) );
else
return QString::number( a, 'f', precision );
}
Associated revisions
qgsDoubleToString: Don't remove trailing zeros when integer
Fix #12947
cherry-picked from ac38b21380
Backported to 2.8.3
History
#1 Updated by Giovanni Manghi over 9 years ago
- Status changed from Open to Feedback
better submit a patch as a pull request on github?
#2 Updated by Matthias Kuhn over 9 years ago
- Status changed from Feedback to Closed
Fixed in changeset ac38b213802919d652b062e65bd96c37c9e199ab.