Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Runtime locale changes do not propagate to existing dialogs and widgets
Forum Updated to NodeBB v4.3 + New Features

Runtime locale changes do not propagate to existing dialogs and widgets

Scheduled Pinned Locked Moved Unsolved General and Desktop
1 Posts 1 Posters 305 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    Pete Klemm
    wrote on last edited by
    #1

    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.

    1 Reply Last reply
    1

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved