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

QLineEdit with QValidator shouldn't reset 'modified' flag after calling fixup()

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P4: Low
    • None
    • 5.5.1
    • None
    • Qt 5.5

    Description

      I've implemented a fixup() function in QIntValidator. After user inputs an invalid number, validator's fixup() function gets called and corrects the text. After this, editingFinished() signal is emitted by QLineEdit as expected. However, in signal handler isModified() returns false.

      I suppose this happens because after calling fixup(), setText is called internally which resets the 'modified' flag. As I understand, QLineEdit should preserve and restore the flag.

      After browsing QLineEdit source code I've noticed that this could also happen when using autocompletion, but I haven't verified this.

      Quoting docs for isModified():
      ...Start the line edit without the best default, and when the default is known, if modified() returns false (the user hasn't entered any text), insert the default value.

      • Because of this bug, QLineEdit could be modified by user yet have 'modified' set to false.

      Attachments

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

        Activity

          People

            qt.team.quick.subscriptions Qt Quick and Widgets Team
            zmeyc Andrey Fidrya
            Votes:
            3 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes