Details
-
Bug
-
Resolution: Fixed
-
P3: Somewhat important
-
5.15.2
-
ec79af7396fd695b25f8f7dba66e8048d54b953b
Description
I have a c++ model object (`controller`) that has a QVariantList property (`stepList`) which contains a list of c++ objects which are owned by c++.
The steps are displayed using a repeater:
QtQuick.Repeater { model: controller.stepList QtQuick.Text { required property var modelData // set by repeater text: modelData.stepNumber } }
When my component gets destroyed, the repeater and the controller get destroyed (and with the controller the steps are destroyed too).
When the step is destroyed, I get the following warning on my console:
Writing to "modelData" broke the binding to the underlying model
I believe this shouldn't be triggered from the repeater model getting destroyed.
For people experiencing this issue, I managed to come up with a reasonably simple workaround by resetting the model on destruction. This also needs that the repeater is destructed before the controller object.
QtQuick.Repeater { model: controller.stepList QtQuick.Component.onDestruction: model=undefined QtQuick.Text { required property var modelData // set by repeater text: modelData.stepNumber } }
Attachments
Issue Links
- relates to
-
QTBUG-91649 "Writing to "entity" broke the binding to the underlying model" warning when removing item from model
- Closed