Trouble with toCurrencyString method



  • Hi everyone, i have a trouble with toCurrencyString method. I already set the country and language (Spanish, Paraguay), and i want to display a certain amount of money on a tableWidget and certain labels, the thing is that it shows the correct currency symbol and decimals acording to my country, but with a little number (i guess it calls power on maths in english) that i dont know why, but its there, any ideas of how can i get rid of it?
    !http://k39.kn3.net/D/F/D/5/F/C/892.jpg(Alter)!

    The code its as the example suggests :

    @setLocale(QLocale(QLocale::Spanish, QLocale::Paraguay));@

    and to set the amount :

    @label->setText(locale().toCurrencyString(precioAnalisis->getPrecio());@



  • And you are sure the getPrecio doesn't give extra characters except the value you need? Maybe test that piece without that call and using fixed value. What happens with this:
    @
    QLocale locale (QLocale::Spanish, QLocale::Panama);
    label->setText(locale.toCurrentcyString(1.15));
    @



  • welcome to devnet. I see issue with Spanish locale. I tried with US and India and is fine. This may be something to do with Spanish local precision settings.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.