How can I do this? I want to create a button by pressing another button, but in the current code of my, I can just create one button and the button I've created it, dissapears.
How could i dynamically do this? Pls help, I'm kinda new to Qt.
That's the main part of it:
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
ui->button1->setVisible(false);
}
MainWindow::~MainWindow() {
delete ui; }
void MainWindow::on_multiplyButton_clicked()
{
ui->button1->setVisible(true);
}
In this way the button just appears, but that doesn't seem like a solution to me, if i would want to scale it. enter image description here
With every click on the multiply a new button should appear.
QMainWindowunless you need the dockable subwindow functionality it offers. You should otherwise use aQDialogorQWidgetas the base class.