masoroso
17th April 2006, 18:44
Hi all,
I am new to this forum and it looks like a great resource for Qt information. I am used to Delphi so it's Qt as well as C++ I'll have to learn :) but it sure looks good what Trolltech did!
Now to the question.
I am not sure on the memory stuff. What is automagically destroyed and what is not?
Here is a piece of code of my test project:
VerticalDialog::VerticalDialog(QWidget *parent)
: QDialog(parent)
{
VerticalItemModel *vertical = new VerticalItemModel;
lytMain = new QGridLayout(this);
lytSurface = new QHBoxLayout();
lytOkCancel = new QHBoxLayout();
lytOpenSave = new QHBoxLayout();
//table
tblVertical = new QTableView();
tblVertical->setAlternatingRowColors(true);
tblVertical->setModel(vertical);
...
Do I need to free the memory myself (for example for the QHBoxLayout classes) or does Qt take care of this? I do not assign a parent to them so there is nobody `to take care of them'??
Thanks in advance,
Rob
I am new to this forum and it looks like a great resource for Qt information. I am used to Delphi so it's Qt as well as C++ I'll have to learn :) but it sure looks good what Trolltech did!
Now to the question.
I am not sure on the memory stuff. What is automagically destroyed and what is not?
Here is a piece of code of my test project:
VerticalDialog::VerticalDialog(QWidget *parent)
: QDialog(parent)
{
VerticalItemModel *vertical = new VerticalItemModel;
lytMain = new QGridLayout(this);
lytSurface = new QHBoxLayout();
lytOkCancel = new QHBoxLayout();
lytOpenSave = new QHBoxLayout();
//table
tblVertical = new QTableView();
tblVertical->setAlternatingRowColors(true);
tblVertical->setModel(vertical);
...
Do I need to free the memory myself (for example for the QHBoxLayout classes) or does Qt take care of this? I do not assign a parent to them so there is nobody `to take care of them'??
Thanks in advance,
Rob