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

Decide upon and document our stance on binding to parent in delegates

    XMLWordPrintable

    Details

    • Commits:
      ed73efa27acd8e7c42a960ef90c2e4a898c20c30 (qt/qtdeclarative/dev) 353fb2226b1a48252ff6e43d404c725f9936e0cf (qt/qtdeclarative/5.15)

      Description

      1. https://codereview.qt-project.org/c/qt/qtdeclarative/+/282546 resulted in some warnings being printed: https://bugreports.qt.io/browse/QTBUG-81976
      2. https://codereview.qt-project.org/c/qt/qtdeclarative/+/290237 was introduced to fix the warning
      3. https://codereview.qt-project.org/c/qt/qtdeclarative/+/291389 reverted the warning because it is a "dubious use case"

      Currently, binding to the parent is not discouraged by documentation, and never has been. ListView's documentation even states what the parent of a delegate is:

      Delegates are instantiated as needed and may be destroyed at any time. They are parented to ListView's contentItem, not to the view itself. State should never be stored in a delegate.

      Whatever we decide on doing, we need to document it comprehensively, so that everyone is aware of the change in behaviour. As it stands now, users are going to run into a tonne of warnings in 5.15, and will have no documentation (or even a ChangeLog entry) to guide them.

      We should:

      • Add a ChangeLog entry somehow
      • Update the "They are parented to ListView's contentItem" line in ListView's documentation
      • Add a paragraph explaining that binding to parent should be avoided and why, and link to this section in the \sa of ListView's delegate documentation

        Attachments

          Issue Links

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

            Activity

              People

              Assignee:
              richard Richard Moe Gustavsen
              Reporter:
              mitch_curtis Mitch Curtis
              Votes:
              3 Vote for this issue
              Watchers:
              6 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:

                  Gerrit Reviews

                  There are no open Gerrit changes