Qt.locale() and decimal point

Hi,

i have a question regarding the Qt.locale and the decimal point running the simulator. When i execute
the following code in the Virtualbox Simulator

var locale = Qt.locale()
console.log("locale is : " + locale.name)
console.log("locale point is : " + locale.decimalPoint)

i get the following output which strikes me as wrong:

[D] onDone:123 - locale is : en_US
[D] onDone:124 - locale point is : ,

So for the en_US locale i am getting a “,” as decimal separator and not a “.” as i would have expected.
Also all the numbers are rendered with a comma as separator. However the on screen keyboard show the “.” as a decimal separator when i use a text field with inputMethodHints: Qt.ImhDigitsOnly.

This basically means that i am not able to enter amounts with fraction digits because of the separator is not properly parsed via

Number.fromLocaleString(locale, myInputField.text)

This is somehow not consistent. Any ideas?

3 Likes

Try to build, install and run e.g. Toeterm and start your application using the installed terminal. Does it still occur? How about running the app in an actual device?

What’s the output of locale command? There are some differences in environmental variables depending if you ssh into a device, or if you use an installed shell, like Fingerterm or Toeterm.

Running the app on the device works fine. No problems there. I will try to check the other outputs you mentioned after my vacation…