Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Trouble with toCurrencyString method
Qt 6.11 is out! See what's new in the release blog

Trouble with toCurrencyString method

Scheduled Pinned Locked Moved General and Desktop
3 Posts 3 Posters 1.1k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    Sebastian90
    wrote on last edited by
    #1

    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());@

    1 Reply Last reply
    0
    • JeroentjehomeJ Offline
      JeroentjehomeJ Offline
      Jeroentjehome
      wrote on last edited by
      #2

      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));
      @

      Greetz, Jeroen

      1 Reply Last reply
      0
      • dheerendraD Offline
        dheerendraD Offline
        dheerendra
        Moderators Qt Champions 2024 Qt Champions 2022 Qt Champions 2017
        wrote on last edited by
        #3

        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.

        Dheerendra
        @Community Service
        Certified Qt Specialist
        https://www.pthinks.com

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved