Directly control inputfield units

Here's the place for discussion related to coding in FreeCAD, C++ or Python. Design, interfaces and structures.
User avatar
sliptonic
Posts: 1579
Joined: Tue Oct 25, 2011 10:46 pm

Directly control inputfield units

Postby sliptonic » Sun May 12, 2019 7:50 pm

Can I explicitly (from Python) set the displayed units of a inputfield? For example, if the user has Standard units set for their UI default and a field is showing '6.35 mm' can I change the unit for that one field so it shows '0.25 in'?
wmayer
Site Admin
Posts: 15001
Joined: Thu Feb 19, 2009 10:32 am

Re: Directly control inputfield units

Postby wmayer » Sun May 12, 2019 8:50 pm

You can change the quantity type, the format of how floats should be displayed or the number of decimals but you cannot change the unit scheme. At the moment this always follows on what is set in the preferences.

In order to support this the InputField class must be adjusted. Feel free to open a feature request.
User avatar
sliptonic
Posts: 1579
Joined: Tue Oct 25, 2011 10:46 pm

Re: Directly control inputfield units

Postby sliptonic » Sun May 12, 2019 9:37 pm

Thank Werner,
I created an issue https://www.freecadweb.org/tracker/view.php?id=3966

I accidentally created in the Path project and I don't seem to have authority to move it someplace more appropriate. If necessary, I'll delete and recreate.
chrisb
Posts: 19749
Joined: Tue Mar 17, 2015 9:14 am

Re: Directly control inputfield units

Postby chrisb » Sun May 12, 2019 9:55 pm

I have a move button and moved it to the general FreeCAD section.