From kde-commits Sun Jan 10 11:42:17 2010 From: Sujith Haridasan Date: Sun, 10 Jan 2010 11:42:17 +0000 To: kde-commits Subject: branches/KDE/4.4/kdeplasma-addons/applets/unitconverter Message-Id: <1263123737.391018.12791.nullmailer () svn ! kde ! org> X-MARC-Message: https://marc.info/?l=kde-commits&m=126312374517908 SVN commit 1072569 by sujithh: A fix to unitconvertor to make consistant of adding zero just after the decimal in the result box when the input box contains zero after the decimal. M +9 -1 unitconverter.cpp --- branches/KDE/4.4/kdeplasma-addons/applets/unitconverter/unitconverter.cpp #1072568:1072569 @@ -23,6 +23,7 @@ #include #include #include +#include #include #include #include @@ -111,7 +112,14 @@ Value dblValueIn(m_pTxtValue1->text().toDouble(), in); Value dblValueOut = dblValueIn.convertTo(out->id()); - m_pTxtValue2->setText(QString::number(dblValueOut.number())); + QRegExp decimalCheck("^\\d+\\.0$"); + QRegExp onlyDecimal("^\\d+$"); + if(decimalCheck.exactMatch(m_pTxtValue1->text()) && onlyDecimal.exactMatch(QString::number(dblValueOut.number()))) { + QString addZero = QString::number(dblValueOut.number()) + ".0"; + m_pTxtValue2->setText(addZero); + } else { + m_pTxtValue2->setText(QString::number(dblValueOut.number())); + } } }