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. [SOLVED] how to align textEdit to the tabwidget tab_3
Forum Updated to NodeBB v4.3 + New Features

[SOLVED] how to align textEdit to the tabwidget tab_3

Scheduled Pinned Locked Moved General and Desktop
2 Posts 1 Posters 2.1k 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.
  • K Offline
    K Offline
    kalster
    wrote on last edited by
    #1

    using the gui builder, in the mainwindow, i have a tabwidget aligned to a grid. when the user clicks a button, a new tab is created with a textEdit aligned to the grid of the tabwidget tab_3 in this example. the problem is that i can't use the gui builder to align the textEdit inside of the tabwidget tab_3 because tab_3 is not created yet. I need to write some code in the mainwindow.cpp file instead of using the gui builder.

    below is the code. it is my attempt to get the textEdit aligned in the tabwidget tab_3, but it is not working.

    @ QGridLayout *layout = new QGridLayout(this);
    textEdit->setParent(ui->tab_3);
    textEdit->setLayout(layout);
    textEdit->show();@

    1 Reply Last reply
    0
    • K Offline
      K Offline
      kalster
      wrote on last edited by
      #2

      after 2 days searching the net, i finally discovered a solution by accident and shortly after i created this topic :). what i needed was the code below.

      @ QGridLayout *layout = new QGridLayout;
      textEdit->setParent(ui->tab_3);
      layout->addWidget(textEdit);
      ui->tab_3->setLayout(layout);
      textEdit->show();@

      1 Reply Last reply
      0

      • Login

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