Dynamically add qtextedits
Unsolved
General and Desktop
-
How can i dynamically add qtextedits to a qframe when i click on the button present outside that qframe and also if these qtextedits increases and get beyond the width or height of the qframe then automatically the scollbars should appear how can i implement this ???
-
Hi! You need to set a layout for the the frame and then add the textedits to that layout. By default,
QFrame
shows a horizontal and a vertical scrollbar when needed, but you can change the scrollbar behaviour withhorizontalScrollBarPolicy
andverticalScrollBarPolicy
properties.void MyWindow::on_pushButton_clicked() { auto vl = new QVBoxLayout(ui->frame); auto te = new QTextEdit(ui->frame); vl->addWidget(te); te->show(); }