Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Add textedit dynamically
Qt 6.11 is out! See what's new in the release blog

Add textedit dynamically

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 928 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    sanjay1155
    wrote on last edited by
    #1

    how can i add textedit dynamically to different position in my workspace on clicking a push button.

    joeQJ 1 Reply Last reply
    0
    • S sanjay1155

      how can i add textedit dynamically to different position in my workspace on clicking a push button.

      joeQJ Offline
      joeQJ Offline
      joeQ
      wrote on last edited by
      #2

      @sanjay1155

      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();
      }
      

      Just do it!

      1 Reply Last reply
      1

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved