I’m confused about Qt parent objects deletion.
#include <QApplication>
#include <QPushButton>
#include <QVBoxLayout>
#include <QHBoxLayout>
#include <QWidget>
#include <QLabel>
int main(int argc, char* argv[]) {
QApplication app(argc, argv);
QWidget *window = new QWidget;
QLabel* label1 = new QLabel("Greetings");
QPushButton* button1 = new QPushButton("One");
QPushButton* button2 = new QPushButton("Two");
QPushButton* button3 = new QPushButton("Three");
QPushButton* button4 = new QPushButton("Four");
QPushButton* button5 = new QPushButton("Five");
QVBoxLayout* vlayout = new QVBoxLayout(window);
vlayout->addWidget(label1, 0, Qt::AlignCenter);
QHBoxLayout* hlayout = new QHBoxLayout();
hlayout->addWidget(button1);
hlayout->addWidget(button2);
hlayout->addWidget(button3);
hlayout->addWidget(button4);
hlayout->addWidget(button5);
vlayout->addLayout(hlayout);
window->show();
return QApplication::exec();
}