[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: branches/KDE/4.4/kdeplasma-addons/applets/unitconverter
From: Sujith Haridasan <sujith.h () gmail ! com>
Date: 2010-01-10 11:42:17
Message-ID: 1263123737.391018.12791.nullmailer () svn ! kde ! org
[Download RAW message or body]
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 <QGraphicsLinearLayout>
#include <QGraphicsProxyWidget>
#include <QLabel>
+#include <QRegExp>
#include <KComboBox>
#include <KLineEdit>
#include <Plasma/ComboBox>
@@ -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()));
+ }
}
}
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic