Best Practice - delete pointer QAbstractButton in QMessageBox
Good day,
In this example below, delete the pointer is correct for the QAbstractButton or not I do that? What is the best practice?
Code:
msg.exec();
delete sim;
delete nao;
if (msg.clickedButton() == sim)
{
......
}
Thanks,
Marcelo E. Geyer
Brazil
Re: Best Practice - delete pointer QAbstractButton in QMessageBox
Those buttons are children of the messagebox and they'll get automatically destructed when the message box itself gets destructed. You don't have to delete them yourself at all. For more details, see: Object Trees and Object Ownership.