Hello,
Just starting with QT and now have a little problem and don't have a solution:
A INI-file have the next value: "123,4 Ab" and I want this value in a QLabel.
Because of the "," it is not possible, how can I handle this?:confused:
Printable View
Hello,
Just starting with QT and now have a little problem and don't have a solution:
A INI-file have the next value: "123,4 Ab" and I want this value in a QLabel.
Because of the "," it is not possible, how can I handle this?:confused:
The comma should have nothing to do with this. How does your ini file look like exactly? What is the exact (compilable) code to reproduce the problem?
i don't know a good solution, but i know one...
you can read the number in two times with
Code:
a=line.section(",",0,0).toInt() b=line.section(",",1,1).toInt() a = a + b/10
this is only an idea, you should check how many numbers after the symbol , and divide it those times by 10.
If you dont find any other solution... try this xD
But he wants it as text, why should he convert it back and forth from integers?
ohhh i missed that part!! :p
then... i cant see the problem there.
I have tested the value by chancing the "," in "." and the value is displaying, rechancing in a "," and the value is not displaying....Quote:
The comma should have nothing to do with this. How does your ini file look like exactly? What is the exact (compilable) code to reproduce the problem?
Code:
INI: [file] run=Woensdag 18 september 2009 cleaning=158,9 Mb verwijderd The code is the "same" as the snippet (only with the value of run and some text).
Is this not to reproduce(?), after a restart from my computer, for me the problem is the same! I'm working in Qt Creator, maybe that's the reason
Without quotes the value is treated as a list of strings. Either wrap the value in quotes or convert the variant to a string list.
Because of the comma in the value (Qt wants to) handle this as a StringList:
chanced in:
after that, replaced the ",".
Thanks to "wysota" for showing me this way.:)
Now I'm sure I can read you "as is". :)Quote:
You don't have to put my name in quotes, there is no comma in it