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

Setting the input mask on a QLineEdit before setting QValidator makes the QLineEdit block input

    XMLWordPrintable

Details

    Description

      An QDoubleValidator in addition with an inputmask on a lineedit is unsuable.

      For example setting a QDoubleValidator and then the input mask, works.
      But setting the input mask first then the validator, input does not work as expected.

      //works
      #include <QApplication>
      #include <QDoubleValidator>
      #include <QLineEdit>
      int main(int argc, char *argv[])
      {
      QApplication app(argc, argv);
      QLineEdit edit("0");
      edit.setValidator(new QDoubleValidator(0.0, 999.0, 1, &edit));
      edit.setInputMask("009.0");
      edit.show();
      return app.exec();
      }

      //does not work
      #include <QApplication>
      #include <QDoubleValidator>
      #include <QLineEdit>
      int main(int argc, char *argv[])
      {
      QApplication app(argc, argv);
      QLineEdit edit("0");
      edit.setInputMask("009.0");
      edit.setValidator(new QDoubleValidator(0.0, 999.0, 1, &edit));
      edit.show();
      return app.exec();
      }

      Attachments

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

        Activity

          People

            bdo Jo Asplin (Inactive)
            admin Administrator
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes