Results 1 to 4 of 4

Thread: Euro sign

  1. #1
    Join Date
    Jan 2006
    Posts
    115
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Euro sign

    Hello anyone,

    Iám using qt-4.4.0 on windows Xp

    I have a model with several columns.
    In the second column i have value's like this € 20.000
    € 70.000
    € 500.000
    € 750.000 etc ...

    I want to sum the euro numbers and put the sum into LineEdit.

    I have read some documentation but i can't find something about this.
    The value € 20.000 have 3 different things.
    The first one is € i think this is a string.
    The second is whitespace between the euro sign en the number.
    The third is the dot in the number.
    Normally i can make sum with integers.(not with strings);
    I have tried severall ListIterators but nothing works.
    Must i first remove the € and the whitespace and the dot and then sum the numbers?

    Have somebody experencie with this.

    Thanks in advance.

  2. #2
    Join Date
    Oct 2006
    Location
    New Delhi, India
    Posts
    2,467
    Thanks
    8
    Thanked 334 Times in 317 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Euro sign

    May you can try regular expression to get the 75.00 part, and convert it to int or double using QString::toInt() or QString::toDouble() methods.

  3. #3
    Join Date
    Jan 2006
    Posts
    115
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Euro sign

    i solved the problem with the Euro sign character.

    Thanks

  4. #4
    Join Date
    Dec 2006
    Posts
    849
    Thanks
    6
    Thanked 163 Times in 151 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Euro sign

    If you have control over the model, I suggest to define another role and adjust the data() function to return the pure double number (as a QVariant) for that role. Saves you the bother of parsing formatted output.

    HTH

Similar Threads

  1. Digitally sign file with private key
    By estanisgeyer in forum Qt Programming
    Replies: 1
    Last Post: 12th June 2008, 15:51
  2. Problem Euro Sign with QLineEdit
    By Kubil in forum Qt Programming
    Replies: 1
    Last Post: 24th August 2007, 05:56

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.