I have such a code and I wonder how should I clean up after it? Should I delete all elements one by one? Should I delete also layouts? Or can I delete just the main element - parent of every other and hope that he will clean up the rest of them?
TableTab
::TableTab(QWidget *parent
) :{
objectNameLabel_
= new QLabel;
tableWidget_ = new RequestTable(parent);
commentaryTextEdit_ = new QPlainTextEdit;
objectNameLabel_->setText("OBIEKT 1");
personLabel_->setText("JOLA");
normatywLabel_->setText("666");
sumLabel_->setText("667");
reInvoiceLabel_->setText("668");
layout->addWidget(normatywLabel_);
layout->addWidget(sumLabel_);
layout->addWidget(reInvoiceLabel_);
calculationsBox->setLayout(layout);
layout->addWidget(commentaryTextEdit_);
layout->addWidget(calculationsBox);
summaryBox_->setLayout(layout);
layout->addWidget(objectNameLabel_);
layout->addWidget(personLabel_);
layout->addWidget(tableWidget_);
layout->addWidget(summaryBox_);
setLayout(layout);
}
TableTab::TableTab(QWidget *parent) :
QWidget(parent)
{
objectNameLabel_ = new QLabel;
personLabel_ = new QLabel;
tableWidget_ = new RequestTable(parent);
summaryBox_ = new QGroupBox;
commentaryTextEdit_ = new QPlainTextEdit;
normatywLabel_ = new QLabel;
sumLabel_ = new QLabel;
reInvoiceLabel_ = new QLabel;
QGroupBox *calculationsBox = new QGroupBox;
objectNameLabel_->setText("OBIEKT 1");
personLabel_->setText("JOLA");
normatywLabel_->setText("666");
sumLabel_->setText("667");
reInvoiceLabel_->setText("668");
QBoxLayout *layout = new QVBoxLayout;
layout->addWidget(normatywLabel_);
layout->addWidget(sumLabel_);
layout->addWidget(reInvoiceLabel_);
calculationsBox->setLayout(layout);
layout = new QHBoxLayout;
layout->addWidget(commentaryTextEdit_);
layout->addWidget(calculationsBox);
summaryBox_->setLayout(layout);
layout = new QVBoxLayout;
layout->addWidget(objectNameLabel_);
layout->addWidget(personLabel_);
layout->addWidget(tableWidget_);
layout->addWidget(summaryBox_);
setLayout(layout);
}
To copy to clipboard, switch view to plain text mode
Bookmarks