Answer the question
In order to leave comments, you need to log in
What happens if you override the destructor in a class derived from QObject?
As far as I know, the QObject class in Qt carries special functions for tracking objects and removing them itself.
I need to execute a function when an object is deleted, so I overridden the destructor. What does it threaten? In general, in Qt, you can make your own destructors, knowing that the object itself monitors its descendants?
class MyClass : public QObject
{
Q_OBJECT
public:
explicit MyClass(QObject *parent = nullptr);
~MyClass();
}
Answer the question
In order to leave comments, you need to log in
I think that qt was not written by idiots, and there, after all, there is a virtual destructor, as it should be for classes intended for inheritance. Everything will be OK.
I need to execute a function when an object is deleted, so I overridden the destructor.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question