I try to learn more about programming by studying open source using UML. The code I have found is in the stage between Qt 3 and Qt 4. The project is not that active so I ask this question here. Maybe I should add that the program using this code do run.
Note, I am a junior. I ask because I want to learn.
My question is simple:
Do this code leak memory?
If not, why ?
void warn(const QString & s) {
// not showed dialog to compute needed size
QDialog d_aux;
Q3VBoxLayout * vbox_aux = new Q3VBoxLayout(&d_aux);
vbox_aux->setMargin(5);
Q3TextEdit * e = new Q3TextEdit(&d_aux);
e->setText(s);
// showed dialog
QDialog * d = new QDialog;
d->setCaption("My caption");
Q3VBoxLayout * vbox = new Q3VBoxLayout(d);
vbox->setMargin(5);
Q3TextView * t = new Q3TextView(d);
QFontMetrics fm(QApplication::font());
int maxw = (MyWindow::get_workspace()->width() * 4) / 5;
int maxh = (MyWindow::get_workspace()->height() * 4) / 5;
int he = (e->lines() + 5) * fm.height();
t->setText(s);
t->setMinimumSize(maxw, (he > maxh) ? maxh : he);
vbox->addWidget(t);
d->show();
}
Thanks // JG