ISISNeutronMuon / MDANSE

MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments
https://www.isis.stfc.ac.uk/Pages/MDANSEproject.aspx
GNU General Public License v3.0
23 stars 5 forks source link

Explicitly set the QLocale in the GUI #603

Closed MBartkowiakSTFC closed 1 week ago

MBartkowiakSTFC commented 2 weeks ago

Description of work The number format will always follow the British convention, where "1 point 0" is 1.0 and not 1,0 or anything else.

closes #595

Fixes

  1. Created a QLocale instance set to English, UK, before starting the GUI.

To test On a platform already set to English, there should be no difference. On platforms using different symbols for the decimal point, the MDANSE GUI should now accept the '.' character instead.

ChiCheng45 commented 1 week ago

I've tested this on a German Windows 11 VM and this change allows me to use '.' characters as the decimal point.

One problem I can see is if they use ',' as the decimal point then QT converts it to a different number e.g.

1,3 -> 1.3E+01

This might be confusing to new users. What do you think about disabling the use of commas altogether?

MBartkowiakSTFC commented 1 week ago

Unfortunately, commas are allowed in English number formatting, as in "1,000,000.05" so a normal QDoubleValidator will not remove them. But you are right, they should be disabled.

MBartkowiakSTFC commented 1 week ago

As far as I can tell, this should work now.