#include "dialog.h"#include "ui_dialog.h"#include "mytask.h"#include <QVBoxLayout>#include <QHBoxLayout>#include <QPushButton>Dialog::Dialog(QWidget *parent) : QDialog(parent), ui(new Ui::Dialog){ ui->setupUi(this); QHBoxLayout *nTask = new QHBoxLayout(this); QPushButton *start = new QPushButton("start",this); QPushButton *cancel = new QPushButton("cancel",this); QPushButton *pause = new QPushButton("pause",this); nTask->addWidget(start); nTask->addWidget(cancel); nTask->addWidget(pause); layout()->addItem(nTask);}Dialog::~Dialog(){ delete ui;}void Dialog::on_pushButton_clicked(){ QHBoxLayout *mTask = new QHBoxLayout(this); QPushButton *start2 = new QPushButton("start 2",this); QPushButton *cancel2 = new QPushButton("cancel 2",this); mTask->addWidget(start2); mTask->addWidget(cancel2); layout()->addItem(mTask);}
setLayout(new QHBoxLayout());