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

QStyledItemDelegate::setEditorData is called unnecessarily after setModelData

    XMLWordPrintable

Details

    • Bug
    • Resolution: Out of scope
    • P2: Important
    • None
    • 6.7.2
    • Core: Item Models
    • None

    Description

      In the Qt item delegate system, after setModelData is called to update the model with the editor's value, Qt unexpectedly calls setEditorData again on the editor. This leads to unnecessary synchronization of the editor, even though the model has already been updated and the editor should be hidden or closed.

      Expected Behavior: Once setModelData is called and the model is updated, Qt should no longer call setEditorData for that editor, as the editor is either no longer visible or in use. The view should update directly from the model, not from the editor.

      Actual Behavior: After setModelData updates the model, Qt calls setEditorData again on the editor widget (e.g., QSpinBox, QLineEdit), which is redundant because the model already holds the updated value, and the editor is no longer visible.

      Attention: you can test using the attachment sample and show the log messages in the console for unnecessarily setEditorData calling.

      Thanks.

      Attachments

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

        Activity

          People

            dfaure_kdab David Faure
            b.najeeb Bassam Na
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes