Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Delete Model when Delegate gets Deleted.
Anup deshpande last edited by
I have a LISTVIEW_1 with model "A" inherited from QAbstractListModel .
I have 1000 models in my model "A" which are also inherited from QAbstractListModel .
The delegate for LISTVIEW_1 is again a ListView. Which means i have a ListView inside a ListView.
Each of these delegate list views are associated with model.
When ever i scroll LISTVIEW_1, delegates(these are also list view) are created and destroyed.
When the delegates are deleted, can I delete Model at the back end when ever delegate gets deleted using delegate index.
My assumption is that when the delegates are deleted, corresponding model object can be deleted safely.
Is that ok delete the back end object when the corresponding delegates gets deleted ?
If the delegates itself is deleted, then there is no use of its back data object at UI side. I feel you safely delete the object at the back. Only thing is that you need to create the same object again when requested by the UI.