View Full Version : Euro sign

4th September 2008, 17:41
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.

4th September 2008, 20:03
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.

8th September 2008, 19:24
i solved the problem with the Euro sign character.


8th September 2008, 20:58
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.