When QVXYModelMapper is destroyed
-
QVXYModelMapper is also associated with the model.
The question here is when does it end?Object lifetimes are governed by C++ rules.
If your QVXYModelMapper is on the stack then it is destroyed when it goes out of scope.
If it is on the heap, i.e. created with new, then it is destroyed when delete is called.If you delete a QObject then all its child QObjects, i.e. those created with a parent, will also be deleted. Your QVXYModelMapper is a QObject and may have a parent, or may not.
See Object TreesWhen the model disappears, all connected objects are destroyed?
No. If you delete a QObject it stops sending signals and anything previous connected is no longer connected. The receiving objects continue to exist (unless they were children of the deleted QObject).
Do I have to delete them separately?
You are responsible for management of object lifetime. You can directly delete objects, use smart pointers, or use the QObject parent-child mechanism.