I have this code:
void MainWindow::on_actionSomeButton_triggered()
{
QWidgetDerivedClass *wid = new QWidgetDerivedClass ;
wid->show();
}
void MainWindow::on_actionSomeButton_triggered()
{
QWidgetDerivedClass *wid = new QWidgetDerivedClass ;
wid->show();
}
To copy to clipboard, switch view to plain text mode
If I create the widget with Qt::WA_DeleteOnClose, this will free the memory allocated with new operator, when the user closes the widget? If not, to free the memory, is it valid to do:
QWidgetDerivedClass::~QWidgetDerivedClass()
{
delete this;
}
QWidgetDerivedClass::~QWidgetDerivedClass()
{
delete this;
}
To copy to clipboard, switch view to plain text mode
Just want to make share I'm not leaking memory.
Bookmarks