X-Git-Url: http://shamusworld.gotdns.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fbase%2Futility.cpp;fp=src%2Fbase%2Futility.cpp;h=0000000000000000000000000000000000000000;hb=9f6ad3fe0b9cb30115a5d38e8af3aebed0d70c08;hp=d5c10cdbc3055b2af5bbfb9a8352eba10f8e6c31;hpb=43c13b052d069ba435277d93867380d00c04931f;p=architektonas diff --git a/src/base/utility.cpp b/src/base/utility.cpp deleted file mode 100644 index d5c10cd..0000000 --- a/src/base/utility.cpp +++ /dev/null @@ -1,45 +0,0 @@ -// 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 -// -// 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; -}