I have a QML ListView, the data model is a QList<QVariant> from C++. The data inside the QVariant is a custom class. The list changes from time to time, how can I update the ListView?
The list can be changed from the C++ code (add or remove data) or by the user from the QML Application. For example, the user can select a ListView entry and click on a delete button. Now I have the problem I don’t know how to delete the selected element from QML.
I tried to invoke a C++ method which deletes the element from the QList, this works, but the QML ListView does not recognize the change of the list.
So I connected the destroyed() signal of the data class in the QList to a slot of the ListView delegate, here I called destroy(), but I got the message “Error: Invalid attempt to destroy() an indestructible object”
How do I delete a object from the QML ListView?
↧








