Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. QtCreator: starting QML application with RUN vs DEBUG affects locale
Forum Updated to NodeBB v4.3 + New Features

QtCreator: starting QML application with RUN vs DEBUG affects locale

Scheduled Pinned Locked Moved Solved Qt Creator and other tools
4 Posts 2 Posters 563 Views
  • 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.
  • B Offline
    B Offline
    bitbang
    wrote on last edited by
    #1

    The following QML code, launched in QtCreator application in RUN vs DEBUG mode, affects locale behaviour:

    console.log(Qt.locale().name, Qt.locale().groupSeparator, Qt.locale().decimalPoint)
    

    When starting the application in RUN ( Ctrl+R, or green arrow icon) prints

    en-US , .
    

    When starting the application in DEBUG ( F5 or green arrow with a bug icon) prints

    en-US . ,
    

    Note how the group separator and decimal point appear reversed. The numeric pad in Virtual Keyboard shows the dot or comma keys accordingly. The DEBUG launch is the expected behaviour.

    I am using Qt Creator 4.10.0
    Based on Qt 5.13.1 (GCC 5.3.1 20160406 (Red Hat 5.3.1-6), 64 bit)
    Built on Sep 4 2019 04:47:37

    In project options, Build environment = Run environment = System environment:

    declare -x LANG="en_US.UTF-8"
    declare -x LANGUAGE="en_US"
    declare -x LC_ADDRESS="it_IT.UTF-8"
    declare -x LC_IDENTIFICATION="it_IT.UTF-8"
    declare -x LC_MEASUREMENT="it_IT.UTF-8"
    declare -x LC_MONETARY="it_IT.UTF-8"
    declare -x LC_NAME="it_IT.UTF-8"
    declare -x LC_NUMERIC="it_IT.UTF-8"
    declare -x LC_PAPER="it_IT.UTF-8"
    declare -x LC_TELEPHONE="it_IT.UTF-8"
    declare -x GDMSESSION="xfce"
    declare -x GDM_LANG="en_US"
    declare -x MANDATORY_PATH="/usr/share/gconf/xfce.mandatory.path"
    declare -x OLDPWD
    declare -x PATH="/home/alberto/Qt5.12.5/5.12.5/gcc_64/bin:/usr/bin:/home/alberto/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin"
    declare -x PWD="/home/alberto"
    
    ( etc. )
    

    What am I doing wrong?

    1 Reply Last reply
    0
    • B bitbang

      Found myself an explanation: dumping the runtime environment within the application ( that is, capturing QProcess output of the "printenv" command), shows that when QtCreator runs the program in debug mode:

      LC_NUMERIC=C
      

      Wheras launching the same application in run mode results in:

      LC_NUMERIC=it_IT.UTF-8
      

      Apparently, debug mode overrides what shown in QtCreator's "Build Settings /Build Environment" (I checked "Use build settings" in "Build SettingsRun Environment")

      Any hint?

      aha_1980A Offline
      aha_1980A Offline
      aha_1980
      Lifetime Qt Champion
      wrote on last edited by aha_1980
      #3

      @bitbang unfortunately this is needed as gdb (the debugger) does not work correctly with foreign locales (e.g. swaps ',' and '.' and therefore formats float numbers in a way Creator cannot parse). unfortunately that affects user programs too.

      I have no idea how to solve that...

      Regards

      Qt has to stay free or it will die.

      B 1 Reply Last reply
      2
      • B Offline
        B Offline
        bitbang
        wrote on last edited by
        #2

        Found myself an explanation: dumping the runtime environment within the application ( that is, capturing QProcess output of the "printenv" command), shows that when QtCreator runs the program in debug mode:

        LC_NUMERIC=C
        

        Wheras launching the same application in run mode results in:

        LC_NUMERIC=it_IT.UTF-8
        

        Apparently, debug mode overrides what shown in QtCreator's "Build Settings /Build Environment" (I checked "Use build settings" in "Build SettingsRun Environment")

        Any hint?

        aha_1980A 1 Reply Last reply
        0
        • B bitbang

          Found myself an explanation: dumping the runtime environment within the application ( that is, capturing QProcess output of the "printenv" command), shows that when QtCreator runs the program in debug mode:

          LC_NUMERIC=C
          

          Wheras launching the same application in run mode results in:

          LC_NUMERIC=it_IT.UTF-8
          

          Apparently, debug mode overrides what shown in QtCreator's "Build Settings /Build Environment" (I checked "Use build settings" in "Build SettingsRun Environment")

          Any hint?

          aha_1980A Offline
          aha_1980A Offline
          aha_1980
          Lifetime Qt Champion
          wrote on last edited by aha_1980
          #3

          @bitbang unfortunately this is needed as gdb (the debugger) does not work correctly with foreign locales (e.g. swaps ',' and '.' and therefore formats float numbers in a way Creator cannot parse). unfortunately that affects user programs too.

          I have no idea how to solve that...

          Regards

          Qt has to stay free or it will die.

          B 1 Reply Last reply
          2
          • aha_1980A aha_1980

            @bitbang unfortunately this is needed as gdb (the debugger) does not work correctly with foreign locales (e.g. swaps ',' and '.' and therefore formats float numbers in a way Creator cannot parse). unfortunately that affects user programs too.

            I have no idea how to solve that...

            Regards

            B Offline
            B Offline
            bitbang
            wrote on last edited by
            #4

            @aha_1980 Setting as solved because this puts a rationale to the observed behavior. So, when in doubt, I can assume debugger runs differ slightly from actual end-user runs. Thank you!

            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