Details
-
Bug
-
Resolution: Done
-
P1: Critical
-
5.15
-
None
-
ed73efa27acd8e7c42a960ef90c2e4a898c20c30 (qt/qtdeclarative/dev) 353fb2226b1a48252ff6e43d404c725f9936e0cf (qt/qtdeclarative/5.15)
Description
- https://codereview.qt-project.org/c/qt/qtdeclarative/+/282546 resulted in some warnings being printed: https://bugreports.qt.io/browse/QTBUG-81976
- https://codereview.qt-project.org/c/qt/qtdeclarative/+/290237 was introduced to fix the warning
- 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
- is duplicated by
-
QTBUG-82393 Deal with parent bindings in delegates
- Closed
- is required for
-
QTBUG-82368 DialogButtonBox::test_attached fails
- Closed
- relates to
-
QTBUG-63729 [REG 5.9.1->5.9.2]: When an item loaded in a loader is destroyed then it can cause children to print warnings that referred to the parent
- Closed
-
QTBUG-77926 Implement Optional Chaining and Nullish coalescing Operator in QML
- Closed
-
QTBUG-81976 ListView delegates produces "TypeError: Cannot read property 'width' of null" when removing item from QAbstractItemModel
- Closed
-
QTBUG-84453 "TypeError: Cannot read property 'width' of null" when running Swipe to Remove example
- Closed