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

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

XMLWordPrintable

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

      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.

        For Gerrit Dashboard: QTBUG-49295
        # Subject Branch Project Status CR V

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

              Created:
              Updated:

                There are no open Gerrit changes