C++ (Qt)//viewer->setLayout(mainLayout);void MainWindow::regenField(){ switch (state) { case 0: { QPushButton *bt = new QPushButton("Confirm"); connect(bt, SIGNAL(clicked()), this, SLOT(regenField())); mainLayout->addWidget(bt); state++; } break; case 1: { QPushButton *bt = new QPushButton("Confirm"); connect(bt, SIGNAL(clicked()), this, SLOT(regenField())); mainLayout->addWidget(bt); state++; } break; } viewer->resize(mainLayout->sizeHint());}
C++ (Qt)mainLayout->itemAt(i)->sizeHint()
C++ (Qt)bt->setMinimumSize(QSize(100,50));
C++ (Qt)viewer->resize(mainLayout->sizeHint());
C++ (Qt)qApp->processEvents();