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 uses different environment for run and debug?!?
Qt 6.11 is out! See what's new in the release blog

QtCreator uses different environment for run and debug?!?

Scheduled Pinned Locked Moved Unsolved Qt Creator and other tools
5 Posts 3 Posters 857 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.
  • D Offline
    D Offline
    django.Reinhard
    wrote on last edited by
    #1

    Hi,

    I have the problem, that on debugging qtcreator uses different environment so that my application does not know the active locale from user.

    This code:

    int main(int argc, char *argv[]) {
      QApplication a(argc, argv);
      QTranslator translator;
      const QStringList uiLanguages = QLocale::system().uiLanguages();
    
      for (const QString& locale : uiLanguages) {
          qDebug() << "got ui-language: >>" << locale << "<<";
          }
    
      // rest ommited
    
      }
    
    

    dumps this messages running application (Ctrl-R):

    got ui-language: >> "de" <<
    got ui-language: >> "en-US" <<
    

    When I start debugging the same application (F5):

    got ui-language: >> "en-US" <<
    got ui-language: >> "en" <<
    

    How can I change behaviour of QtCreator?

    1 Reply Last reply
    0
    • C Offline
      C Offline
      ChrisW67
      wrote on last edited by
      #2

      I do not see that behaviour with Qt Creator 6.0.2 and a new project using your code built using Qt 6.3.1 on Linux.

      The environment that the each build profile uses when run the application is independent of the others. By default the running process is given the system environment unless you override it in Project Settings. If you override the environment and set LANG or LC_* (on Linux) then the running executable should see that. Make sure you do not have that situation.

      1 Reply Last reply
      0
      • D Offline
        D Offline
        django.Reinhard
        wrote on last edited by
        #3

        Hi Chris,

        thank you for your attention.

        I rechecked all qtcreator versions I have - but before I have to say:
        I use linux and I did not change system environment nor did I change environment settings of any qtcreator.

        Version 5: works as expected (giving de and en)
        Version 6, version 7 and version 8 don't give "de", but 2 times "en"

        All variants started the same way, which means using main menu of kde-desktop.

        Do you have any advice, how I could tweak environment of qtcreator 6 and above to use locale setting of current user?

        JonBJ 1 Reply Last reply
        0
        • D django.Reinhard

          Hi Chris,

          thank you for your attention.

          I rechecked all qtcreator versions I have - but before I have to say:
          I use linux and I did not change system environment nor did I change environment settings of any qtcreator.

          Version 5: works as expected (giving de and en)
          Version 6, version 7 and version 8 don't give "de", but 2 times "en"

          All variants started the same way, which means using main menu of kde-desktop.

          Do you have any advice, how I could tweak environment of qtcreator 6 and above to use locale setting of current user?

          JonBJ Offline
          JonBJ Offline
          JonB
          wrote on last edited by
          #4

          @django-Reinhard
          Have a look at running your application outside of Creator, directly for Run and under gdb for Debug. Do those behave the same?

          1 Reply Last reply
          0
          • D Offline
            D Offline
            django.Reinhard
            wrote on last edited by
            #5

            Hi,

            just tried running app outside of QtCreator -
            yes, the behaviour is identical running from commandline or running through gdb.

            (Thanks for the hint!)

            1 Reply Last reply
            0

            • Login

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