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

QString::arg(): When specifying %L1 with a number that would have a group separator in it when the default locale is set to omit the group separator then this option is ignored and it is shown anyway

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P3: Somewhat important
    • 4.7.1
    • 4.6.2
    • None
    • 720f4ca0ec3b42a101ac24b2cf74cdc87d29eac9

    Description

      QString::arg(): When specifying %L1 with a number that would have a group separator in it when the default locale is set to omit the group separator then this option is ignored and it is shown anyway

      Example:

      #include <QtCore>
      
      int main(int argc, char **argv)
      {
          QLocale l(QLocale::English, QLocale::UnitedKingdom);
          l.setNumberOptions(QLocale::OmitGroupSeparator);
          QLocale::setDefault(l);
          QCoreApplication ca(argc, argv);
          QString str("%L1");
          str = str.arg(5000);
          qDebug() << str;
          return 0;
      }
      

      In the example given, str should be 5000, but it is in fact 5,000. The patch attached should solve the issue.

      Attachments

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

        Activity

          People

            goffart Olivier Goffart (closed Nokia identity) (Inactive)
            anshaw Andy Shaw (closed Nokia identity) (Inactive)
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes