sj755
sj755

Reputation: 4062

Freeing Memory for QPushButtons with QMessageBox

I've instantiated a QMessageBox and added a couple of buttons to it like so:

QMessageBox message;
cancelButton = message.addButton(tr("Cancel"), QMessageBox::RejectRole);
okButton = message.addButton(tr("OK"), QMessageBox::ActionRole);

Is it necessary to call the destructors for each pushbutton before exiting, or does the QMessageBox destructor take care of everything?

Upvotes: 0

Views: 219

Answers (1)

Jay
Jay

Reputation: 14441

No.

When parent objects are deleted they delete their children. So the buttons will be deleted when 'message' is.

Upvotes: 4

Related Questions