-
Bug
-
Resolution: Done
-
P3: Somewhat important
-
None
-
5.5.1, 5.12.4, 5.13.0, 5.15.17, 6.5.5, 6.6.3, 6.7.0
-
Shovelling Snow, Q1/2020 Finale, Q2/2020 kick off
I implement a QAbstractItemModel subclass which returns QObject* a instance with properties.
I implement QML code to consume the properties from the instance:
ListView { delegate: Item { id: deleg property var obj: model.instance Text { text: deleg.obj.name } // ...
I implement a method to delete an item.
beginRemoveRows(QModelIndex(), i, i); m_instances.at(i)->deleteLater(); m_instances.removeAt(i); endRemoveRows();
When it is invoked I get warnings from QML
main.qml:29: TypeError: Cannot read property 'colorName' of null main.qml:24: TypeError: Cannot read property 'name' of null
It seems that QML evaluates bindings in delegates whose model rows have already been deleted. It should probably not do that.
Small testcase attached
- relates to
-
QTBUG-98463 "TypeError: Cannot read property 'x' of undefined" when binding to delegate index and model role in the same binding
-
- Open
-
For Gerrit Dashboard: QTBUG-45500 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
553541,1 | WIP: invalidate delegates which are about to be removed | dev | qt/qtdeclarative | Status: NEW | -2 | 0 |