Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "widget.h"
- #include <QFormLayout>
- #include <QHBoxLayout>
- #include <QVBoxLayout>
- #include <QDebug>
- Widget::Widget(QWidget *parent)
- : QWidget(parent)
- {
- reset = new QPushButton("reset");
- box = new QGroupBox(0);
- mainLayout = new QVBoxLayout;
- mainLayout->addWidget(reset);
- mainLayout->addWidget(box);
- setLayout(mainLayout);
- connect(reset, SIGNAL(clicked()), this, SLOT(resetPressed()));
- show();
- qDebug() <<"init end";
- }
- void Widget::resetPressed()
- {
- box->hide();
- box->deleteLater();
- box = new QGroupBox(this);
- boxLayout = new QFormLayout();
- for(unsigned int i=0; i<3; i++)
- {
- QPushButton *trickyButton = new QPushButton;
- boxLayout->addRow("hopeless button", trickyButton);
- }
- mainLayout->addWidget(box);
- box->setLayout(boxLayout);
- box->show();
- qDebug() << "items after add: " << boxLayout->count();
- }
- Widget::~Widget()
- {
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement