Add textedit dynamically
Unsolved
General and Desktop
-
how can i add textedit dynamically to different position in my workspace on clicking a push button.
-
Hi, friend, welcome devnet.
You can new
QTextEdit
object and set parent. then, set resize and move position. like the following code:#include "dialog.h" #include "ui_dialog.h" #include <QTextEdit> Dialog::Dialog(QWidget *parent) : QDialog(parent), ui(new Ui::Dialog) { ui->setupUi(this); } Dialog::~Dialog() { delete ui; } void Dialog::on_btn_clicked() { QTextEdit *edit = new QTextEdit(this); edit->resize(200,40); edit->move(10,10); edit->show(); }