Shouldnt you be using the locale functions?
http://www.cplusplus.com/reference/locale/
I haven't personally used them, so sorry no experience I can share.
if you write your own function to do the conversion don't assume the number
has a decimal portion it may be rounded to whole numbers only.
Chris
Rebel Software <http://www.rebel.com.au>
On 30/05/2014 9:11 AM, Allan wrote:
On 29/05/14 12:36, Allan wrote:
Previously, I dealt successfully with importing with a user's locale,
but now I'm hitting a problem.
I'm working on a patch to fix "[Bug 334995] CSV import Debit/Credit mode
only looks at one column, credits become 0.00". I have the patch
working for my own locale - UK. However, for other locales, I converted
my test file to use comma decimal and semi-colon separator. This is
giving me grief. What I'm trying to do is to convert a QString currency
amount to double, to be able to test if the amount is non-zero, as
against empty.
The basic problem came as a surprise, when I found that QString was not
locale-aware. I'm getting caught between QLocale and KLocale. I am
setting the country to, say, France. However, QLocale still seems to be
set to UK. Things seem to work if I set QLocale::default() to France,
but how do I know which country the user is in?
It looks like QLocale doesn't take account of KDE country change, but
retains the original system locale. How can I get the KDE locale to
give a country that QLocale will accept?
Or, am I missing the simple answer?
Allan
Replying to myself here.
It sounds like all will be sweetness and light in Qt5/Framework 5, at
least on the locale front.
Meanwhile, Plan B
Allan
_______________________________________________
KMyMoney-devel mailing list
KMyMoney-devel@kde.org
https://mail.kde.org/mailman/listinfo/kmymoney-devel
_______________________________________________
KMyMoney-devel mailing list
KMyMoney-devel@kde.org
https://mail.kde.org/mailman/listinfo/kmymoney-devel