dot instead comma ?

Post here for help on using FreeCAD's graphical user interface (GUI).
Forum rules
and Helpful information
IMPORTANT: Please click here and read this first, before asking for help

Also, be nice to others! Read the FreeCAD code of conduct!
openBrain
Posts: 3950
Joined: Fri Nov 09, 2018 5:38 pm

Re: dot instead comma ?

Post by openBrain » Tue Mar 24, 2020 9:03 pm

uwestoehr wrote:
Tue Mar 24, 2020 8:11 pm
Therefore here is a screenshot:
:( With your only test I'm desperate to find a global solution.
Here are my results :

Code: Select all

Qt 5.9.5 / Locale ('fr_FR', 'UTF-8')
Alpha : 0x3b // 0x2e // 0x2e // 0x2000000
Numpad : 0x5b // 0x2e // 0x2e // 0x0
My "alpha dot" returns with modifier set (and numpad has null modifier) while yours is the opposite (yours is more logical)...
Maybe just my keyboard is rotten, I hope to have results from others. ;)
User avatar
wandererfan
Posts: 3871
Joined: Tue Nov 06, 2012 5:42 pm

Re: dot instead comma ?

Post by wandererfan » Tue Mar 24, 2020 11:10 pm

openBrain wrote:
Tue Mar 24, 2020 7:06 pm
@all, to gather information about keyboard layouts and how they reacts in Qt, could you please run the below/attached macro and post results here.
I don't have a numeric keypad on my laptop, but here are "dot" and "comma":

"dot"
Qt 5.9.5 / Locale ('en_CA', 'UTF-8')
Alpha : 0x3c // 0x2e // 0x2e // 0x0
Numpad : Select/focus this line and press 'dot' on numeric pad

"comma"
Qt 5.9.5 / Locale ('en_CA', 'UTF-8')
Alpha : 0x3b // 0x2c // 0x2c // 0x0
Numpad : Select/focus this line and press 'dot' on numeric pad
User avatar
uwestoehr
Posts: 1446
Joined: Sun Jan 27, 2019 3:21 am

Re: dot instead comma ?

Post by uwestoehr » Tue Mar 24, 2020 11:49 pm

Another PC but still windows:

FC 0.19master (compiled by myself):

English menus:
comma + comma
Qt 5.12.1 / Locale (None, None)
Alpha : 0x33 // 0xbc // 0x2c // 0x0
Numpad : 0x53 // 0x6e // 0x2c // 0x20000000
dot + comma:
Qt 5.12.1 / Locale (None, None)
Alpha : 0x34 // 0xbe // 0x2e // 0x0
Numpad : 0x53 // 0x6e // 0x2c // 0x20000000

German menu:
comma + comma
Qt 5.12.1 / Locale (None, None)
Alpha : 0x33 // 0xbc // 0x2c // 0x0
Numpad : 0x53 // 0x6e // 0x2c // 0x20000000
dot + comma:
Qt 5.12.1 / Locale (None, None)
Alpha : 0x34 // 0xbe // 0x2e // 0x0
Numpad : 0x53 // 0x6e // 0x2c // 0x20000000

FC 0.18.4 (official installer, compiled by sgrogan):

German menus:
comma + comma
Qt 5.6.2 / Locale (None, None)
Alpha : 0x33 // 0xbc // 0x2c // 0x0
Numpad : 0x53 // 0x6e // 0x2c // 0x20000000
dot + comma:
Qt 5.6.2 / Locale (None, None)
Alpha : 0x34 // 0xbe // 0x2e // 0x0
Numpad : 0x53 // 0x6e // 0x2c // 0x20000000
wmayer
Site Admin
Posts: 15732
Joined: Thu Feb 19, 2009 10:32 am

Re: dot instead comma ?

Post by wmayer » Thu Mar 26, 2020 4:02 pm

openBrain wrote:This ticket is "dot instead comma". Not the purpose here as it is to allow both. Also the ticket you pointed never had a forum discussion. See why it never get audience ?
Interpreting both dots and commas as a decimal point is even worse because this introduces an ambiguity and can cause unexpected behaviour. No other SW package I know of implements such a strange behaviour.
IMO, our FreeCAD specific widgets are extensions of Qt widgets to support quantities or allow to bind expressions. But the fundamental behaviour must not be different to the Qt widgets.
uwestoehr wrote:That does not mean I am in general opposed to it, but it must be discussed carefully and is nothing for the first day after a feature freeze
There is no feature freeze yet. Only because triplus claimed it doesn't mean it's officially announced.
I see now. Where can I find the policy that one should use this? As I wrote, I have seen at different places that QDoubleSpinBox is still in use - maybe it is not well communicated that one must use Gui::DoubleSpinBox instead of QDoubleSpinBox.
There is no such policy. Everybody who thinks that for his spin boxes neither quantities nor expressions are needed is free to use QDoubleSpinBox or QSpinBox.

So, what would be OK for me is to flip the behaviour of group separator and decimal point but interpreting both characters as decimal point is a no-go. It's actually easy to interpret the dot as decimal point. All what must be done is to implement an option in the preferences if the application-wide locale should be set to "C" and inside the Application constructor this line must be added:

Code: Select all

QLocale::setDefault(QLocale(QLocale::C));
A nice side-effect of this change is that also Qt's QDoubleSpinBox interpret dot as decimal point. Hence no need to change any widget classes directly.
User avatar
uwestoehr
Posts: 1446
Joined: Sun Jan 27, 2019 3:21 am

Re: dot instead comma ?

Post by uwestoehr » Thu Mar 26, 2020 4:11 pm

wmayer wrote:
Thu Mar 26, 2020 4:02 pm
There is no feature freeze yet. Only because triplus claimed it doesn't mean it's officially announced.
Oh. That is a very valuable info.
However, I am a bit puzzled. Who is the release maintainer, who defines freeze dates etc. and communicates them where?
It is my first release time as FC developer therefore please excuse my noob questions.

(In other projects there was a release maintainer organizing these things - of curse in open discussions. One person or a defined group finally has to made a decision and this needs to be communicated well to avoid leaving upset developers.)

There is no such policy. Everybody who thinks that for his spin boxes neither quantities nor expressions are needed is free to use QDoubleSpinBox or QSpinBox.
Thanks for the clarification.
openBrain
Posts: 3950
Joined: Fri Nov 09, 2018 5:38 pm

Re: dot instead comma ?

Post by openBrain » Thu Mar 26, 2020 4:29 pm

wmayer wrote:
Thu Mar 26, 2020 4:02 pm
Interpreting both dots and commas as a decimal point is even worse because this introduces an ambiguity and can cause unexpected behaviour. No other SW package I know of implements such a strange behaviour.
Actually much software do this when your locale is French (and probably others). More precisely they convert the numpad dot to a comma. But you may not know that. ;)
IMO, our FreeCAD specific widgets are extensions of Qt widgets to support quantities or allow to bind expressions. But the fundamental behaviour must not be different to the Qt widgets.
In this case the QuantitySpinBox validator would deserve a close look. Here I can basically enter as much dots as I want, being before of after the comma (only one comma is allowed though). The problem is that the first dot is considered the decimal separator, and everything after the second one is ignored.
So, what would be OK for me is to flip the behaviour of group separator and decimal point but interpreting both characters as decimal point is a no-go. It's actually easy to interpret the dot as decimal point. All what must be done is to implement an option in the preferences if the application-wide locale should be set to "C" and inside the Application constructor this line must be added:

Code: Select all

QLocale::setDefault(QLocale(QLocale::C));
A nice side-effect of this change is that also Qt's QDoubleSpinBox interpret dot as decimal point. Hence no need to change any widget classes directly.
What would you think of rather handing that as a global event filter at app or main window level ? With rules something like :
  • If your locale decimal separator isn't dot
  • AND
  • If your locale group (thousands) separator isn't dot
  • AND
  • If specifically a double is being entered
  • THEN
  • The numpad dot (only this one) is replaced by locale decimal separator
This could also be made an optional behavior.
wmayer
Site Admin
Posts: 15732
Joined: Thu Feb 19, 2009 10:32 am

Re: dot instead comma ?

Post by wmayer » Thu Mar 26, 2020 4:52 pm

uwestoehr wrote:
Thu Mar 26, 2020 4:11 pm
However, I am a bit puzzled. Who is the release maintainer, who defines freeze dates etc. and communicates them where?
It is my first release time as FC developer therefore please excuse my noob questions.
Usually Yorik and I think about when it's time for a feature freeze. The freeze will be then around a month later and another month for heavy testing and bug fixes. If all is considered good the version will be released.
openBrain wrote:
Thu Mar 26, 2020 4:29 pm
If your locale decimal separator isn't dot
AND
If your locale group (thousands) separator isn't dot
AND
If specifically a double is being entered
THEN
The numpad dot (only this one) is replaced by locale decimal separator
Which language doesn't use dots neither as decimal point nor as group separator? Apart from that I'm not convinced that it's a good thing to implement a global event filter to try to handle doubles. There are so many different possibilities to modify the content of a spin box.
openBrain
Posts: 3950
Joined: Fri Nov 09, 2018 5:38 pm

Re: dot instead comma ?

Post by openBrain » Thu Mar 26, 2020 6:03 pm

wmayer wrote:
Thu Mar 26, 2020 4:52 pm
Which language doesn't use dots neither as decimal point nor as group separator? Apart from that I'm not convinced that it's a good thing to implement a global event filter to try to handle doubles. There are so many different possibilities to modify the content of a spin box.
According Wikipedia :
SI style (French version), Albania, Belgium (French), Bulgaria, Canada (French-speaking), the Czech Republic, Estonia, Finland, France, Hungary, Kosovo, Latin Europe, Latvia, Lithuania, Norway, Peru, Poland, Portugal, Russia, Serbia, Slovakia, South Africa, Sweden, Switzerland (officially encouraged, except currency numbers[43]), Ukraine, Vietnam (in education)
Notice that SI style (French or English) uses space as thousands separator. ;)
chrisb
Posts: 24350
Joined: Tue Mar 17, 2015 9:14 am

Re: dot instead comma ?

Post by chrisb » Thu Mar 26, 2020 6:22 pm

openBrain wrote:
Thu Mar 26, 2020 6:03 pm
Notice that SI style (French or English) uses space as thousands separator. ;)
What a mess :roll:
triplus
Posts: 9428
Joined: Mon Dec 12, 2011 4:45 pm

Re: dot instead comma ?

Post by triplus » Fri Mar 27, 2020 8:33 pm

wmayer wrote:
Thu Mar 26, 2020 4:02 pm
There is no feature freeze yet. Only because triplus claimed it doesn't mean it's officially announced.
Sorry, but you could have drop a line in the thread we have had discuss this. But OK, point taken.

P.S. As for dot vs. comma. What people in this thread are asking for if it is possible to only convert the numpad key to a decimal separator in cases where locale and keyboard layout differ. As they can't input the decimal separator using numpad. Therefore for just this use case (numpad) and not to in general change on how FreeCAD manages decimal separator.
Post Reply

Who is online

Users browsing this forum: No registered users and 15 guests