+++ /dev/null
-// utility.cpp
-//
-// Part of the Architektonas Project
-// Originally part of QCad Community Edition by Andrew Mustun
-// Extensively rewritten and refactored by James L. Hammons
-// Portions copyright (C) 2001-2003 RibbonSoft
-// Copyright (C) 2010 Underground Software
-// See the README and GPLv2 files for licensing and warranty information
-//
-// JLH = James L. Hammons <jlhamm@acm.org>
-//
-// Who When What
-// --- ---------- -----------------------------------------------------------
-// JLH 05/05/2010 Moved implementation from header to this file. :-)
-//
-
-#include "utility.h"
-
-/**
- * Converts a double to a string cutting away unnecessary 0's.
- * e.g. 2.70000 -> 2.7
- */
-QString Utility::doubleToString(double value, int precision/*= 6*/)
-{
- QString ret;
-
- ret.setNum(value, 'f', precision);
-
- if (ret.contains('.'))
- {
- // remove trailing zeros:
- while (ret.at(ret.length() - 1) == '0')
- {
- ret.truncate(ret.length() - 1);
- }
-
- // remove trailing .
- if (ret.at(ret.length() - 1) == '.')
- {
- ret.truncate(ret.length() - 1);
- }
- }
-
- return ret;
-}