Skip to content

Decimal point shoud be specified in QLocale #374

@FooDawn

Description

@FooDawn

A lot of countries use decimal comma (0,1), and not decimal point (0.1).

I am using PySide2.
Qt sets QLocale object initialized to the system locale.
On Windows and Mac, this locale will use the decimal/grouping characters and date/time formats specified in the system configuration panel.
So in _NumberValueMenu in NodeGraphQt/custom_widgets/properties_bin/custom_widget_value_edit.py _convert_text would have problems.

For me specifying it in the beginning help solve this problems

    def set_locale(self):
        """ Due to different locale (decimal point is ,) in some countries
            So for decimal point being . for all users it must be Specified here the beginning
        """
        want_locale = QtCore.QLocale(QtCore.QLocale.English, QtCore.QLocale.Europe)
        QtCore.QLocale.setDefault(want_locale)
        print('Now my locale decimal point is:', QtCore.QLocale().decimalPoint())

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions