Do we need a virtual destructor for the classes that will be used in Qt-way: set QObject-parent, which will call the QObject destructor deleteLater()or something similar for any object for which it was set as a parent?
For instance:
class MyWidget : public QWidget {
public:
MyWidget() {
w = new QWidget(this);
}
private:
QWidget *w;
}
Do we need a virtual destructor for the class MyWidgetif it is inherited? I see no reason for this, because it does not delete anything, and every property of the class that is obtained from QObjectwill be removed from MyWidget :: QWidget :: QObject of the destructor.
source
share