View Issue Details

IDProjectCategoryView StatusLast Update
0002866FreeCADBugpublic2018-01-02 11:34
Reportermlampert Assigned To 
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
Product Version0.17 
Target Version0.17Fixed in Version0.17 
Summary0002866: Gui::InputField rounds values to 2 digits
DescriptionSetting a value in an InputField rounds the value to the nearest 2 decimal digit internal value.

Set value to 1.125 mm once Enter is hit it shows 1.13 mm. Editing the same value again gives 1.13 mm, and not 1.125 mm. Retrieving the value from the InputField does indeed result in the value getting truncated, if converted to um it shows 1130um.
Additional InformationForum thread for discussion: http://forum.freecadweb.org/viewtopic.php?f=10&t=20022
TagsNo tags attached.
FreeCAD Information

Relationships

related to 0002970 closedsliptonic Path Make output precision a user preference 
related to 0001822 closed Drawing Scale factor property in drawing page limited to one digit (sometime two) 

Activities

wmayer

2017-09-24 19:46

administrator   ~0010175

In the user settings you can define the number of decimals which in your case might be set to 2. To avoid confusion it's maybe best to restrict the input field not to allow to enter more than 2 digits after the separator like for a QDoubleSpinBox.

mlampert

2017-09-24 20:07

developer   ~0010177

The problem is not the displaying of 2 digits, that's what I expected from the setting. The issue is that value is actually rounded to 2 digits - which is absolutely not what I expected.

Maybe it's a documentation issue and we should make it clear that "if you only see 2 digits than that is all there will be".

wmayer

2018-01-02 11:34

administrator   ~0010658

https://github.com/FreeCAD/FreeCAD/commit/a6a004b6b2e9dd0c3b1f3706253af71c27a47035

Current behaviour is absolutely correct but it's true that it should be more obvious to the user that if per user settings 2 decimals are set that only 2 decimals are used.
So, this can e.g. be done when the input field loses focus that it displays the quantity as it will be used when reading it out.

Btw, if needed you can also change the number of decimals for an input field independent of user settings:

ui=Gui.UiLoader()
field=ui.createWidget("Gui::InputField")
field.setProperty("unit", "K")
field.show()
field.setProperty("precision",6)
field.property("quantityString")

Issue History

Date Modified Username Field Change
2017-01-18 19:49 mlampert New Issue
2017-01-18 20:02 Kunda1 Additional Information Updated
2017-05-02 11:10 Kunda1 Relationship added related to 0001822
2017-05-02 11:11 Kunda1 Relationship added related to 0002970
2017-09-24 19:46 wmayer Note Added: 0010175
2017-09-24 20:07 mlampert Note Added: 0010177
2017-10-18 12:28 wmayer Target Version => 0.17
2018-01-02 11:34 wmayer Status new => closed
2018-01-02 11:34 wmayer Resolution open => fixed
2018-01-02 11:34 wmayer Fixed in Version => 0.17
2018-01-02 11:34 wmayer Note Added: 0010658