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

QIntValidator blocks negative numbers in Swedish locale

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Not Evaluated Not Evaluated
    • 4.8.7, 5.2.0 RC1
    • 4.8.6, 5.1.1, 5.2.0 Alpha, 5.2.0 Beta1
    • None
    • Mac 10.8.5 or Win7
    • dc80838a378268a13ccbe74b481528f1ad631918 qt4: efce5d8361af41bf60dd16ce5aec65fe2fd84f88

      Setting a QIntValidator on a QLineEdit fails to accept negative values entered when the locale is sv_SE. The following code should allow numbers from -9 to 9 in the LineEdit, but Qt blocks the minus sign when the locale is Swedish.

      QLineEdit* leSE = new QLineEdit();
      QLocale locSE("sv_SE");
      QIntValidator* pValidator = new QIntValidator(-9, 9, leSE);
      pValidator->setLocale(locSE);
      leSE->setValidator(pValidator);

      This same method works well in many other locales, including similar Scandinavian languages such an Finnish.

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

            sgaist Samuel Gaist
            bargonaut Brad Sandman
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes