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

incomplete fix for QTBUG-138 : "fixup() not called on editingFinished():"

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: P3: Somewhat important P3: Somewhat important
    • 5.6.0 RC
    • 4.5.2
    • Widgets: Itemviews
    • None
    • f5f8a8c346b7566b544d500254c6f9f4eb109c79

      QStyledItemDelegate is comitting data before QValidator::fixup() of
      QLineEdit attached would be called so results of QValidator::fixup()
      sometimes are ignored

      There is attached project TestCase. Validator's fixup() should
      augment hex values with leading zeros.

      STEPS TO REPRODUCE / TEST CASE

      1. Start executable TestCase.exe (built using of attached project)
      2. Double click on some table cell
      3. Enter single hex digit into the edit widget (you will see something
      like SNAPSHOT-1.PNG attached)
      4. Press ENTER key (you will see something like SNAPSHOT-2.PNG
      attached). So far so good - fixup() of custom HexValidator is called
      OK and the entered single digit would transform to a 8-digit value.
      5. Repeat steps 2 and 3.
      6. Instead of pressing ENTER, press Arrow Down key (you will see
      something like SNAPSHOT-3.PNG attached). In other words the edited
      value consists of single digit as before. This means that fixup()
      function's result was ignored even if fixup() was called after
      editing finished.

      QT VERSIONS WHERE BUG MANIFESTS ITSELF:

      TestCase demonstrates identical behaviour being compiled under
      Qt 4.5.2 and being compiled under Qt 4.6.0-beta1.

      WORKAROUND:

      To workaround the bug one may reimplement
      QStyledItemDelegate::setModelData() and manually call fixup() before
      comitting the data (i.e. before model->setData() call).

      One may define macro WORKAROUND within the file HexDelegate.h of TestCase
      project attached and recompile the project to put the workaround
      into operation.

        1. TestCase.zip
          38 kB
          Keith Isdale (closed Nokia identity)
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            Unassigned Unassigned
            isdale Keith Isdale (closed Nokia identity) (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes