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

Conflicting examples in the documentation for QValidator::Intermediate

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 5.13.0
    • Documentation
    • None
    • All

    Description

      The documentation about the Intermediate state is misleading and presents two conflicting examples. In particular, this is an excerpt from the documentation for QValidator:

      For a line edit that accepts integers from 10 to 1000 inclusive, 42 and 123 are Acceptable, the empty string and 5 are Intermediate, and "asdf" and 1114 is Invalid.

      That is, 1114 is Invalid for a validator that accepts integers from 10 to 1000 inclusive (eg QIntValidator{10, 1000, parent}). Note that it mentions explicitly that these results are those of a validator used in combination with a line edit. However, 1114 is Intermediate in this case, at least it's considered so while editing.

      On the other side, this is an example taken from the documentation for QIntValidator:

      QString str;
      int pos = 0;
      QIntValidator v(100, 900, this);
      
      // ...
      
      str = "999";
      v.validate(str, pos);    // returns Intermediate

      That is, 999 is Intermediate for the range 0-900 and this makes perfectly sense. It's also consistent with the behavior of a line edit to which users set a QIntValidator for the range 100-900.

       

       

      Attachments

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

        Activity

          People

            docteam Qt Documentation Team
            skypjack Michele Caini
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes