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. Dynamically add qtextedits
Forum Updated to NodeBB v4.3 + New Features

Dynamically add qtextedits

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 473 Views 1 Watching
  • 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 sanjay1155
    #1

    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 ???

    1 Reply Last reply
    0
    • ? Offline
      ? Offline
      A Former User
      wrote on last edited by A Former User
      #2

      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 with horizontalScrollBarPolicy and verticalScrollBarPolicy properties.

      void MyWindow::on_pushButton_clicked()
      {
          auto vl = new QVBoxLayout(ui->frame);
          auto te = new QTextEdit(ui->frame);
          vl->addWidget(te);
          te->show();
      }
      
      1 Reply Last reply
      3

      • Login

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