View Issue Details
|ID||Project||Category||View Status||Date Submitted||Last Update|
|0000697||Sketcher||public||2012-05-06 20:30||2012-05-07 07:18|
|Target Version||Fixed in Version||0.13|
|Summary||0000697: Text boxes to set dimension constraints insert a space between thousands and hundreds digits that makes the data invalid.|
|Description||Consider you have a dimension constraint set at 1234 (mm) (segment or radius, whatever)|
You want to change it to 1245
You double click the dimension, the dialog 'insert datum' opens and shows 'datum : 1 234' instead of 'datum : 1234'
If you let the space and set the datum to '1 245', the new value is refused (probably thought invalid) and remains equal to 1234. You need to erase that space to have the new value accepted.
As I see things, the float value is converted to text for the dialog box using an inappropriate conversion format.
|Additional Information||I'm very new to FreeCad and to this bug tracker, so please forgive my awkwardness and help me to improve !|
|Tags||No tags attached.|
I've dug deeper into this bug. It is in fact a localization issue. (I'm a french ubuntu user)
The responsible source code is :
src / Mod / Sketcher / Gui / EditDatumDialog.cpp :
double newDatum = ui_ins_datum.lineEdit->text().toDouble(&ok);
You can notice that localization is done one way but not on the way back.
I suggest something like that :
double newDatum = QLocale::system().toDouble(ui_ins_datum.lineEdit->text(),&ok);
but careful... I know that french rules expect that space between thousand and hundred digits but who really use it ? I still want to be able to set the data to 1234 without this damned space. And I like the fact that 12,34 and 12.34 are currently both accepted (french official rule is ',' but who really cares between ',' and '.' ?).
So what ? do not localize at all these data ? Try to interpret with C rule if the first attempt with the system locale failed ?
It's up to you !
A localized application like FreeCAD should also use the right character for the group separator and the decimal point. So, the right way to achieve that is using the QLocale class (btw, Qt's QinputDialog class does the same).
Your suggestion QLocale::system().toDouble() should fix the problem. I had a similar problem with the dot as group separator and comma as decimal point and the above fixed it.
And about comma and point it IS a matter we should take into consideration. E.g. in German comma is the decimal point and dot is the group separator while in English it's exactly the other way round.
||git show 2ded296|
|2012-05-06 20:30||azen0r||New Issue|
|2012-05-06 21:21||azen0r||Note Added: 0002022|
|2012-05-06 21:23||azen0r||Note Edited: 0002022|
|2012-05-06 21:37||azen0r||Note Edited: 0002022|
|2012-05-07 07:17||wmayer||Note Added: 0002025|
|2012-05-07 07:18||wmayer||Note Added: 0002026|
|2012-05-07 07:18||wmayer||Status||new => closed|
|2012-05-07 07:18||wmayer||Resolution||open => fixed|
|2012-05-07 07:18||wmayer||Fixed in Version||=> 0.13|