Results 1 to 4 of 4

Thread: Money Format

  1. #1
    Join Date
    Apr 2009
    Location
    İstanbul, Türkiye
    Posts
    26
    Thanks
    1

    Default Money Format

    I have a QLineEdit, and when user enter some number into it, i want to replace that string with its currency represantation.

    I tried to change the input on textChanged(const QString&) signal on that QlineEdit object, but i had involved lots of problems.

    IMHO, There must be easy way to tell QLineEdit, use that locale to change numbers into currency.

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Money Format

    What exactly is the problem?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    Apr 2008
    Posts
    26
    Thanked 1 Time in 1 Post
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Money Format

    Quote Originally Posted by newermind View Post
    I have a QLineEdit, and when user enter some number into it, i want to replace that string with its currency represantation.

    I tried to change the input on textChanged(const QString&) signal on that QlineEdit object, but i had involved lots of problems.

    IMHO, There must be easy way to tell QLineEdit, use that locale to change numbers into currency.
    Rather than textChanged() were you will be changing the text as the user types, try editingFinished() where you can write a 'fixup' routine to format the text. The routine will trigger when the user tabs out or clicks out of the QLineEdit.

  4. #4
    Join Date
    Jan 2008
    Location
    Poland
    Posts
    687
    Thanks
    4
    Thanked 140 Times in 132 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Money Format

    Did you tried implementing your own validator? Subclass QValidator for checking if the input is right (for example no letters between digits), and fixing input data with QValidator::fixup().
    Don't know if it's the best and fastest way but I would give it a try.
    Last edited by faldzip; 19th May 2009 at 14:38. Reason: spelling error
    I would like to be a "Guru"

    Useful hints (try them before asking):
    1. Use Qt Assistant
    2. Search the forum

    If you haven't found solution yet then create new topic with smart question.

Similar Threads

  1. How can i convert qstring to money format ?
    By newermind in forum Qt Programming
    Replies: 9
    Last Post: 17th April 2016, 22:19
  2. Replies: 1
    Last Post: 15th April 2009, 09:00
  3. QLineEdit with money format
    By haldrik in forum Qt Programming
    Replies: 10
    Last Post: 12th September 2008, 16:34
  4. Is there a known problem with QMimeData on Mac OS X?
    By Wurgl in forum Qt Programming
    Replies: 8
    Last Post: 27th February 2008, 22:21
  5. Some very weird compilation warnings
    By MarkoSan in forum Qt Programming
    Replies: 21
    Last Post: 23rd January 2008, 16:48

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.