Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Runtime locale changes do not propagate to existing dialogs and widgets
Pete Klemm last edited by
I have a desktop application in which I support several languages. I have a comboBox with all supported languages and those change correctly as they call ui->retranslate().
My problem is I also need to change the locale of all child widgets so the display and entry of numeric data uses the correct decimal separator.
I set the now locale in QMainWindow but I have been unable to get that new locale to propagate down to all existing child widgets.
Here is how I modify the locale in QMainWindow:
QLocale locale = QLocale(selectedLanguage); locale.setNumberOptions(QLocale::OmitGroupSeparator); QLocale::setDefault(locale); setLocale(locale);
However none of QMainWindow's child widgets have the new locale.
The documentation states that locale changes propagate down to children.
I must be missing something here, or I have done something that blocks the propagation.
A search has not provided any good examples.