Attach a dynamic button to a window
-
So basically I want to make the following: When a button is pushed, create a button at point X with size Y which has text which is extracted from a textEdit. This is the function I have made:
@void MainWindow::on_pushButton_released()
{
QString a = ui->textEdit->toPlainText();
QPushButton* ptr = new QPushButton(a);
addWidget(ptr); // I figured I should use this function, thing is I don't know what should call it
ptr->show();
ptr->setGeometry(260, 140, 40, 40);
}@It works, however the window appears on the 260, 140 on my desktop. I want it to be 260,140 in the main window, wherever it is. Thanks in advance.