Qt objects highlighted with help neware pretty much handled for you. Things will be cleared at some point (almost always when the parent is destroyed), because Qt objects have a good parent relationship with the children.
So my question is this: given that some widgets exist for the life of the application, is it considered good / useful to limit the scope of some child widgets? It seems to me that if I donโt attach, the application will not be able to free these objects until the application exits. For instance:
MyMainWindow::contextMenu(...) {
QMenu *menu = new QMenu(this);
menu->exec();
}
vs
MyMainWindow::contextMenu(...) {
QMenu *menu = new QMenu(this);
menu->exec();
delete menu;
}
vs
MyMainWindow::contextMenu(...) {
QScopedPointer<QMenu> menu(new QMenu(this));
menu->exec();
}
, , , , , . . , Qt? Qt ?