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

QIntValidate does not recognize group symbol from QLocale

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • 4.7.0
    • 4.4.1
    • Core: Locales (i18n)
    • None
    • b81b8e43ad57183ed66086ec90cabef5906ab9a2

    Description

      QIntValidator's have a setLocal() method to set the Locale for the validator. When setting this validator to a QLineEdit and then calling setText(locale.toString(1234)) on the QLineEdit an int with a comma in it is set. This though is not a valid integer even with the Locale set. This should not be the case.

      What is the purpose of setting a locale for QIntValidator if it's not going to respect the locale.

      Example:

      #include <QApplication>
      #include <QDialog>
      #include <QLineEdit>
      #include <QIntValidator>
      #include <QVBoxLayout>
      
      int main(int argc, char *argv[])
      {
          QApplication app(argc, argv);
          QDialog dialog;
          QLineEdit* pLineEdit1 = new QLineEdit("", &dialog);
          QVBoxLayout* vBox = new QVBoxLayout;
          vBox->addWidget(pLineEdit1);
          dialog.setLayout(vBox);
          QLocale loc;
          QIntValidator* pValidator = new QIntValidator(pLineEdit1);
          pValidator->setLocale(loc);
          pLineEdit1->setValidator(pValidator);
          int n = 1234;
          pLineEdit1->setText(loc.toString(n));
          return dialog.exec();
      }

      Attachments

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

        Activity

          People

            vfm Thierry Bastian (closed Nokia identity) (Inactive)
            janichol Andy Nichols
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes