Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-67661

Inconsistencies of the behaviour of QLocale, and no respect to system's local

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P4: Low
    • None
    • 5.7.1, 5.10.1
    • Core: Locales (i18n)
    • None
    • Linux (4.14.0 amd64), OS (Debian testing), Libc (2.27), GCC (7.3), LibstdC++ (6.4)

       

    Description

      Hi !

      Qt core seems to correctly detect system local, but it seems to incorrectly respect it.

      #include <qapplication.h>
      #include <qpushbutton.h>
      
      int main( int argc, char **argv )
      {
          QApplication a( argc, argv );
      
          QPushButton hello( "Hello world!");
          hello.resize( 100, 30 );
          hello.show();
      
          QString test;
          test = QLocale::system().toString(0.5);// ==> 0.5       MARK2
          test = QLocale::system().name();       // ==> fr_FR     MARK1
          test = QLocale().toString(0.5);        // ==> 0.5
          test = QLocale(QLocale::system().name()).toString(0.5);  // ==> 0,5   expected value ! MARK3
          QLocale locale = QLocale(QLocale::French, QLocale::France);
          test = locale.toString(0.5);           // ==> 0,5   expected value !
          QLocale::setDefault(QLocale(QLocale::French, QLocale::France));
          test = QLocale().toString(0.5);        // ==> 0,5   expected value !
      
          return a.exec();
      }
      

      As you can see on MARK1, my system's local is correctly detected but as illustrated on MARK2 Qt doesn't respect it: it should have display 0,5 (and not 0.5).

      I worked the problem and saw that :

      • by using directly an instance of QLocale (initialized with fr_FR), all is correct
      • when using a console application, there is no problem whatsoever; here an extract of the .pro file
        QT -= gui
        
        CONFIG += c++11 console
        CONFIG -= app_bundle
        
      • this problem may be connected to the following tickets : 58504,  63324

      the ldd on the binary:

      linux-vdso.so.1 (0x00007ffeefaf9000)
      libQt5Widgets.so.5 => /home/hide/.root/Applications/Qt/5.10.1/gcc_64/lib/libQt5Widgets.so.5 (0x00007f7a384bf000)
      libQt5Gui.so.5 => /home/hide/.root/Applications/Qt/5.10.1/gcc_64/lib/libQt5Gui.so.5 (0x00007f7a37cd8000)
      libQt5Core.so.5 => /home/hide/.root/Applications/Qt/5.10.1/gcc_64/lib/libQt5Core.so.5 (0x00007f7a37588000)
      libGL.so.1 => /usr/lib/x86_64-linux-gnu/libGL.so.1 (0x00007f7a372fc000)
      libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f7a370de000)
      libstdc+.so.6 => /usr/lib/x86_64-linux-gnu/libstdc+.so.6 (0x00007f7a36d59000)
      libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f7a369c6000)
      libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f7a367ae000)
      libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f7a363f4000)
      libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007f7a361da000)
      libicui18n.so.56 => /home/hide/.root/Applications/Qt/5.10.1/gcc_64/lib/libicui18n.so.56 (0x00007f7a35d41000)
      libicuuc.so.56 => /home/hide/.root/Applications/Qt/5.10.1/gcc_64/lib/libicuuc.so.56 (0x00007f7a35989000)
      libicudata.so.56 => /home/hide/.root/Applications/Qt/5.10.1/gcc_64/lib/libicudata.so.56 (0x00007f7a33fa6000)
      libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f7a33da2000)
      libgthread-2.0.so.0 => /usr/lib/x86_64-linux-gnu/libgthread-2.0.so.0 (0x00007f7a33ba0000)
      libglib-2.0.so.0 => /lib/x86_64-linux-gnu/libglib-2.0.so.0 (0x00007f7a3388a000)
      /lib64/ld-linux-x86-64.so.2 (0x00007f7a38f00000)
      libGLX.so.0 => /usr/lib/x86_64-linux-gnu/libGLX.so.0 (0x00007f7a33659000)
      libGLdispatch.so.0 => /usr/lib/x86_64-linux-gnu/libGLdispatch.so.0 (0x00007f7a333a3000)
      libpcre.so.3 => /lib/x86_64-linux-gnu/libpcre.so.3 (0x00007f7a33131000)
      libX11.so.6 => /usr/lib/x86_64-linux-gnu/libX11.so.6 (0x00007f7a32df1000)
      libXext.so.6 => /usr/lib/x86_64-linux-gnu/libXext.so.6 (0x00007f7a32bdf000)
      libxcb.so.1 => /usr/lib/x86_64-linux-gnu/libxcb.so.1 (0x00007f7a329b7000)
      libXau.so.6 => /usr/lib/x86_64-linux-gnu/libXau.so.6 (0x00007f7a327b3000)
      libXdmcp.so.6 => /usr/lib/x86_64-linux-gnu/libXdmcp.so.6 (0x00007f7a325ad000)
      libbsd.so.0 => /lib/x86_64-linux-gnu/libbsd.so.0 (0x00007f7a32398000)
      librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f7a32190000)

      Attachments

        1. strace.txt
          262 kB
          Majid EL IDRISSI

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              thiago Thiago Macieira
              lem__mel Majid EL IDRISSI
              Votes:
              1 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:

                Gerrit Reviews

                  There are no open Gerrit changes